docker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheItem

type CacheItem struct {
	ID        string
	CacheType string
	Size      int64
	Age       time.Duration
	InUse     bool
}

CacheItem holds info about a build cache entry.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps the Docker SDK client with helper methods.

func NewClient

func NewClient() (*Client, error)

NewClient creates a new Docker client using the local Docker socket.

func (*Client) DeleteContainer

func (c *Client) DeleteContainer(ctx context.Context, shortID string) error

DeleteContainer removes a stopped container.

func (*Client) DeleteImage

func (c *Client) DeleteImage(ctx context.Context, shortID string) error

DeleteImage removes an image by short ID.

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(ctx context.Context, name string) error

DeleteVolume removes a volume by name.

func (*Client) DiskUsageSummary

func (c *Client) DiskUsageSummary(ctx context.Context) (DiskSummary, error)

func (*Client) ListBuildCache

func (c *Client) ListBuildCache(ctx context.Context) ([]CacheItem, error)

ListBuildCache returns all build cache entries via DiskUsage.

func (*Client) ListReclaimableImages

func (c *Client) ListReclaimableImages(ctx context.Context) ([]ImageItem, error)

ListReclaimableImages returns images that are dangling or not used by any container.

func (*Client) ListStoppedContainers

func (c *Client) ListStoppedContainers(ctx context.Context) ([]ContainerItem, error)

ListStoppedContainers returns all non-running containers.

func (*Client) ListUnusedVolumes

func (c *Client) ListUnusedVolumes(ctx context.Context) ([]VolumeItem, error)

ListUnusedVolumes returns volumes not mounted by any container.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping checks connectivity to the Docker daemon.

func (*Client) PruneCache

func (c *Client) PruneCache(ctx context.Context) (int64, error)

PruneCache clears all build cache.

type ContainerItem

type ContainerItem struct {
	ID      string
	Name    string
	Image   string
	Size    int64
	Age     time.Duration
	Project string
	Status  string
}

ContainerItem holds info about a stopped container.

type DiskSummary

type DiskSummary struct {
	TotalImages     int64
	TotalContainers int64
	TotalVolumes    int64
	TotalCache      int64
}

DiskSummary holds totals from Docker's DiskUsage API.

type ImageItem

type ImageItem struct {
	ID      string
	Tags    []string
	Size    int64
	Age     time.Duration
	Project string // from com.docker.compose.project label
	Reason  string // "dangling" or "unused"
}

ImageItem holds info about a reclaimable image.

type VolumeItem

type VolumeItem struct {
	Name    string
	Size    int64
	Age     time.Duration
	Project string
	Driver  string
}

VolumeItem holds info about an unused volume.

Jump to

Keyboard shortcuts

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