docker

package
v0.1.0-beta.6 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerNetworkIP

func ContainerNetworkIP(containerInfo container.InspectResponse, networkName string) (string, error)

ContainerNetworkInfo extracts the container's IP address

func EnsureImageUpToDate

func EnsureImageUpToDate(ctx context.Context, cli *client.Client, logger *slog.Logger, imageConfig config.Image) error

func GetAppContainers

func GetAppContainers(ctx context.Context, cli *client.Client, listAll bool, appName string) ([]container.Summary, error)

GetAppContainers returns a slice of container summaries filtered by labels.

Parameters:

  • ctx: the context for the Docker API requests.
  • cli: the Docker client used to interact with the Docker daemon.
  • listAll: if true, the function returns all containers including stopped ones; if false, only running containers are returned.
  • appName: if not empty, only containers associated with the given app name are returned.

Returns:

  • A slice of container summaries.
  • An error if something went wrong during the container listing.

func GetRegistryServer

func GetRegistryServer(imageConfig *config.Image) string

func HealthCheckContainer

func HealthCheckContainer(ctx context.Context, cli *client.Client, logger *slog.Logger, containerID string, initialWaitTime ...time.Duration) error

func LoadImageFromTar

func LoadImageFromTar(ctx context.Context, cli *client.Client, tarPath string) error

func NewClient

func NewClient(ctx context.Context) (*client.Client, error)

func PruneImages

func PruneImages(ctx context.Context, cli *client.Client, logger *slog.Logger) (uint64, error)

PruneImages removes dangling (unused) Docker images and returns the amount of space reclaimed.

func PushImage

func PushImage(ctx context.Context, cli *client.Client, imageRef string, imageConfig *config.Image) error

func RemoveContainers

func RemoveContainers(ctx context.Context, cli *client.Client, logger *slog.Logger, appName, ignoreDeploymentID string) (removedIDs []string, err error)

RemoveContainers attempts to remove old containers for a given app and ignoring a specific deployment.

func RemoveImages

func RemoveImages(ctx context.Context, cli *client.Client, logger *slog.Logger, appName, ignoreDeploymentID string, deploymentsToKeep int) error

RemoveImages removes extra (duplicate) image tags for a given app, keeping only the newest N tags based on the deploymentID. Running containers reference the image by digest; if an image is in use we allow removal of duplicate tags as long as at least one tag is preserved.

func StopContainers

func StopContainers(ctx context.Context, cli *client.Client, logger *slog.Logger, appName, ignoreDeploymentID string) (stoppedIDs []string, err error)

Types

type ContainerRunResult

type ContainerRunResult struct {
	ID           string
	DeploymentID string
	ReplicaID    int
}

func RunContainer

func RunContainer(ctx context.Context, cli *client.Client, deploymentID, imageRef string, targetConfig config.TargetConfig) ([]ContainerRunResult, error)

type RemoveContainersResult

type RemoveContainersResult struct {
	ID           string
	DeploymentID string
}

Jump to

Keyboard shortcuts

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