Help us shape the future of Go! Take the 2026 Go Developer Survey

docker

package
v2.17.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

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.

func CountNetworkUsage added in v2.16.0

func CountNetworkUsage(networks []network.Summary, containers []container.Summary) (inuse, unused, total int)

CountNetworkUsage returns in-use and unused counts for non-default networks, and the total of all networks.

Types

type DockerClientService

type DockerClientService struct {
	*client.Client
	// contains filtered or unexported fields
}

func NewDockerClientService

func NewDockerClientService(_ context.Context, db *database.DB, cfg *config.Config, settingsService *settings.SettingsService, eventBusOptions ...bus.Option) *DockerClientService

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 (*DockerClientService) EventBus

func (s *DockerClientService) EventBus() *bus.DockerEventBus

func (*DockerClientService) GetAllContainers

func (s *DockerClientService) GetAllContainers(ctx context.Context) ([]container.Summary, int, int, int, error)

func (*DockerClientService) GetAllImages

GetAllImages lists images and containers concurrently and returns the images together with their usage counts, including total image size.

func (*DockerClientService) GetAllNetworks

func (s *DockerClientService) GetAllNetworks(ctx context.Context) ([]network.Summary, int, int, int, error)

func (*DockerClientService) GetClient

func (s *DockerClientService) GetClient(ctx context.Context) (*client.Client, error)

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 (s *DockerClientService) ListContainers(ctx context.Context) ([]container.Summary, error)

func (*DockerClientService) ListImages

func (s *DockerClientService) ListImages(ctx context.Context) ([]image.Summary, error)

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.

Jump to

Keyboard shortcuts

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