Documentation
¶
Index ¶
- func CountImageUsage(images []image.Summary, containers []container.Summary) imagetypes.UsageCounts
- func CountNetworkUsage(networks []network.Summary, containers []container.Summary) (inuse, unused, total int)
- type DockerClientService
- func (s *DockerClientService) Call[T any](ctx context.Context, op func(context.Context, *client.Client) (T, error)) (T, error)
- func (s *DockerClientService) Close()
- func (s *DockerClientService) DockerHost() string
- func (s *DockerClientService) Engine(ctx context.Context) (compat.EngineCompatibilityInfo, error)
- func (s *DockerClientService) EventBus() *bus.DockerEventBus
- func (s *DockerClientService) GetAllContainers(ctx context.Context) ([]container.Summary, int, int, int, error)
- func (s *DockerClientService) GetAllImages(ctx context.Context) ([]image.Summary, imagetypes.UsageCounts, error)
- func (s *DockerClientService) GetAllNetworks(ctx context.Context) ([]network.Summary, int, int, int, error)
- func (s *DockerClientService) GetClient(ctx context.Context) (*client.Client, error)
- func (s *DockerClientService) GetSnapshot(ctx context.Context, envID string) (*dashboard.DockerSnapshot, error)
- func (s *DockerClientService) ListCoalesced[T any](ctx context.Context, group *singleflight.Group, ...) (T, error)
- func (s *DockerClientService) ListContainers(ctx context.Context) ([]container.Summary, error)
- func (s *DockerClientService) ListImages(ctx context.Context) ([]image.Summary, error)
- func (s *DockerClientService) RefreshClient(ctx context.Context) error
- func (s *DockerClientService) WatchEvents(ctx context.Context)
- func (s *DockerClientService) WithClient(dockerClient *client.Client) *DockerClientService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountImageUsage ¶
func CountImageUsage(images []image.Summary, containers []container.Summary) imagetypes.UsageCounts
CountImageUsage tallies in-use, unused, and total image counts plus the summed image size. An image is in use when a container references its ID.
Types ¶
type DockerClientService ¶
func NewDockerClientService ¶
func (*DockerClientService) Call ¶ added in v2.17.0
func (s *DockerClientService) Call[T any](ctx context.Context, op func(context.Context, *client.Client) (T, error)) (T, error)
Call runs op against the cached client under the configured Docker API timeout. Streaming calls (logs, events, attach, pull, exec, stats, wait) must not use it because it applies a deadline.
func (*DockerClientService) Close ¶
func (s *DockerClientService) Close()
Close closes the cached Docker client.
func (*DockerClientService) DockerHost ¶
func (s *DockerClientService) DockerHost() string
DockerHost returns the configured DOCKER_HOST value.
func (*DockerClientService) Engine ¶ added in v2.17.0
func (s *DockerClientService) Engine(ctx context.Context) (compat.EngineCompatibilityInfo, error)
func (*DockerClientService) EventBus ¶
func (s *DockerClientService) EventBus() *bus.DockerEventBus
func (*DockerClientService) GetAllContainers ¶
func (*DockerClientService) GetAllImages ¶
func (s *DockerClientService) GetAllImages(ctx context.Context) ([]image.Summary, imagetypes.UsageCounts, error)
GetAllImages lists images and containers concurrently and returns the images together with their usage counts, including total image size.
func (*DockerClientService) GetAllNetworks ¶
func (*DockerClientService) GetClient ¶
GetClient returns a singleton Docker client instance. It initializes the client on the first call.
func (*DockerClientService) GetSnapshot ¶
func (s *DockerClientService) GetSnapshot(ctx context.Context, envID string) (*dashboard.DockerSnapshot, error)
func (*DockerClientService) ListCoalesced ¶ added in v2.17.0
func (s *DockerClientService) ListCoalesced[T any](ctx context.Context, group *singleflight.Group, op func(context.Context, *client.Client) (T, error)) (T, error)
ListCoalesced shares one detached Call among concurrent callers; each waiter stops on its own context, nothing is cached, and the shared result must be treated as immutable. Streaming calls (logs, events, attach, pull, exec, stats, wait) must not use it because Call applies a deadline.
func (*DockerClientService) ListContainers ¶
func (*DockerClientService) ListImages ¶
func (*DockerClientService) RefreshClient ¶
func (s *DockerClientService) RefreshClient(ctx context.Context) error
RefreshClient probes the Docker daemon and recreates the cached client when the daemon's effective API version changed.
func (*DockerClientService) WatchEvents ¶
func (s *DockerClientService) WatchEvents(ctx context.Context)
func (*DockerClientService) WithClient ¶
func (s *DockerClientService) WithClient(dockerClient *client.Client) *DockerClientService
WithClient returns a copy of the service bound to an already-connected Docker client, skipping host discovery. Used where the caller owns the connection.