docker

package
v0.0.0-...-3cdae3a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDockerImageID

func FormatDockerImageID(s string, maxLen int) string

Helper function to truncate docker image ID with ellipsis

func FormatLabels

func FormatLabels(labels map[string]string) string

Helper function used to format the docker image labels Key Value Pairs

func FormatSize

func FormatSize(bytes int64) string

Helper function to converts bytes to human-readable format

func MeasureExecutionTime

func MeasureExecutionTime(f func()) string

Measure Execution Time

func RemoveDockerImage

func RemoveDockerImage(d *DockerClient, ctx context.Context, imageID string, opts image.RemoveOptions) error

RemoveDockerImage

func ToBytes

func ToBytes(size float64, unit string) float64

converts value to bytes

Types

type DockerClient

type DockerClient struct {
	CLI *client.Client
}

func (*DockerClient) CleanupStoppedContainerImages

func (d *DockerClient) CleanupStoppedContainerImages() error

CleanupStoppedContainerImages removes images associated with stopped containers

func (*DockerClient) InitDockerClient

func (d *DockerClient) InitDockerClient() error

InitDockerClient initializes a new Docker client

func (*DockerClient) ListUnusedImages

func (d *DockerClient) ListUnusedImages() ([]image.Summary, error)

ListUnusedImages returns a list of unused Docker images

func (*DockerClient) PrintUnusedImages

func (d *DockerClient) PrintUnusedImages() error

PrintUnusedImages lists the images that would be removed (Dry Run)

func (*DockerClient) RemoveExceedSizeLimit

func (d *DockerClient) RemoveExceedSizeLimit(sizeLimit float64, unit string) error

Remove Images that exceed a specific size limit

func (*DockerClient) RemoveUnusedImages

func (d *DockerClient) RemoveUnusedImages(concurrent bool) error

RemoveUnusedImages deletes unused Docker images

func (*DockerClient) VerboseModeCleanup

func (d *DockerClient) VerboseModeCleanup() error

VerboseModeCleanup gives more details while doing the cleanup of unused images

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL