Documentation
¶
Index ¶
- func ContainerNetworkIP(containerInfo container.InspectResponse, networkName string) (string, error)
- func EnsureImageUpToDate(ctx context.Context, cli *client.Client, logger *slog.Logger, ...) error
- func ExecInContainer(ctx context.Context, cli *client.Client, containerID string, cmd []string) (stdout, stderr string, exitCode int, err error)
- func GetAppContainers(ctx context.Context, cli *client.Client, listAll bool, appName string) ([]container.Summary, error)
- func GetRegistryServer(imageConfig *config.Image) string
- func HealthCheckContainer(ctx context.Context, cli *client.Client, logger *slog.Logger, ...) error
- func LoadImageFromTar(ctx context.Context, cli *client.Client, tarPath string) error
- func NewClient(ctx context.Context) (*client.Client, error)
- func PruneImages(ctx context.Context, cli *client.Client, logger *slog.Logger) (uint64, error)
- func PushImage(ctx context.Context, cli *client.Client, imageRef string, ...) error
- func RemoveContainers(ctx context.Context, cli *client.Client, logger *slog.Logger, ...) (removedIDs []string, err error)
- func RemoveImages(ctx context.Context, cli *client.Client, logger *slog.Logger, ...) error
- func StopContainers(ctx context.Context, cli *client.Client, logger *slog.Logger, ...) (stoppedIDs []string, err error)
- type ContainerRunResult
- type RemoveContainersResult
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 ExecInContainer ¶
func ExecInContainer(ctx context.Context, cli *client.Client, containerID string, cmd []string) (stdout, stderr string, exitCode int, err error)
ExecInContainer executes a command in a running container and returns the output.
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 HealthCheckContainer ¶
func LoadImageFromTar ¶
func PruneImages ¶
PruneImages removes dangling (unused) Docker images and returns the amount of space reclaimed.
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.
Types ¶
type ContainerRunResult ¶
func RunContainer ¶
func RunContainer(ctx context.Context, cli *client.Client, deploymentID, imageRef string, targetConfig config.TargetConfig) ([]ContainerRunResult, error)