docker

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDockerSocketConnectionFailed = errors.New("failed to connect to docker socket")
	ErrNoContainerToStart           = errors.New("no container to start")
	ComposeVersion                  string
)
View Source
var (
	ErrMountPointNotFound     = errors.New("mount point not found")
	ErrMountPointNotWriteable = errors.New("mount point is not writeable")
	ErrContainerIDNotFound    = errors.New("container ID not found")
)
View Source
var DocoCDLabels = docoCdLabelNames{
	Metadata: docoCDLabelNamesMetadata{
		Manager: "cd.doco.metadata.manager",
		Version: "cd.doco.metadata.version",
	},
	Deployment: docoCdLabelNamesDeployment{
		Name:       "cd.doco.deployment.name",
		Timestamp:  "cd.doco.deployment.timestamp",
		WorkingDir: "cd.doco.deployment.working_dir",
		TargetRef:  "cd.doco.deployment.target.ref",
		CommitSHA:  "cd.doco.deployment.target.sha",
		Trigger:    "cd.doco.deployment.trigger",
	},
	Repository: docoCdLabelNamesRepository{
		Name: "cd.doco.repository.name",
		URL:  "cd.doco.repository.url",
	},
}

DocoCDLabels contains the label key names used by DocoCD to identify deployed containers and their metadata.

Functions

func CheckMountPointWriteable added in v0.13.0

func CheckMountPointWriteable(mountPoint container.MountPoint) error

CheckMountPointWriteable checks if a mount point is writable by attempting to create a file in it.

func ConnectToSocket

func ConnectToSocket() (net.Conn, error)

ConnectToSocket connects to the docker socket.

func CreateDockerCli

func CreateDockerCli(quiet, verifyTLS bool) (command.Cli, error)

func DeployCompose

func DeployCompose(ctx context.Context, dockerCli command.Cli, project *types.Project,
	deployConfig *config.DeployConfig, payload webhook.ParsedPayload,
	repoDir, latestCommit, appVersion string, forceDeploy bool,
) error

DeployCompose deploys a project as specified by the Docker Compose specification (LoadCompose).

func DeployStack added in v0.14.0

func DeployStack(
	jobLog *slog.Logger, internalRepoPath, externalRepoPath string, ctx *context.Context,
	dockerCli *command.Cli, payload *webhook.ParsedPayload, deployConfig *config.DeployConfig,
	latestCommit, appVersion string, forceDeploy bool,
) error

DeployStack deploys the stack using the provided deployment configuration.

func DestroyStack added in v0.14.0

func DestroyStack(
	jobLog *slog.Logger, ctx *context.Context,
	dockerCli *command.Cli, deployConfig *config.DeployConfig,
) error

DestroyStack destroys the stack using the provided deployment configuration.

func Exec added in v0.13.0

func Exec(client client.APIClient, containerID string, cmd ...string) (out string, err error)

func GetContainerID added in v0.13.0

func GetContainerID(client client.APIClient, name string) (id string, err error)

GetContainerID retrieves the container ID for a given service name.

func GetLabeledContainers added in v0.13.0

func GetLabeledContainers(ctx context.Context, cli *client.Client, key, value string) (containers []container.Summary, err error)

GetLabeledContainers retrieves all containers with a specific label key and value.

func GetMountPointByDestination added in v0.13.0

func GetMountPointByDestination(cli *client.Client, containerID, destination string) (container.MountPoint, error)

GetMountPointByDestination retrieves the mount point of a container volume/bind mount by its destination (mount point inside the container).

func LoadCompose

func LoadCompose(ctx context.Context, workingDir, projectName string, composeFiles []string) (*types.Project, error)

LoadCompose parses and loads Compose files as specified by the Docker Compose specification.

func NewHttpClient

func NewHttpClient() *http.Client

func OnCrash added in v0.13.0

func OnCrash(client client.APIClient, containerID string, do func(), onErr func(err error))

OnCrash listens for container events and executes a callback function when the specified container crashes or stops.

func VerifySocketConnection

func VerifySocketConnection() error

VerifySocketConnection verifies whether the application can connect to the docker socket.

func VerifySocketRead

func VerifySocketRead(httpClient *http.Client) error

VerifySocketRead verifies whether the application can read from the docker socket.

Types

This section is empty.

Jump to

Keyboard shortcuts

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