docker

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunShell added in v0.2.2

func RunShell(ctx context.Context, cli *client.Client, cfg *config.Config, job config.JobConfig, logger *log.Logger) error

RunShell drops the user into an interactive /bin/sh inside the job's exact environment: same image, variables, workdir, cache mounts, copied workspace, and — when the job declares services — the same sidecars on the same network. Status chatter goes to stderr; stdout stays clean for the TTY.

Types

type ConfigAdapter

type ConfigAdapter interface {
	ToContainerConfig(job config.JobConfig) *container.Config
	ToHostConfig(job config.JobConfig) *container.HostConfig
	ToImageHostConfig(image string) string
}

func NewConfigAdapter

func NewConfigAdapter(cfg *config.Config, logger *log.Logger) ConfigAdapter

type ContainerManager

type ContainerManager struct {
	// contains filtered or unexported fields
}

func NewContainerManager

func NewContainerManager(cli *client.Client, adapter ConfigAdapter, logger *log.Logger) *ContainerManager

func (*ContainerManager) AttachLogger

func (c *ContainerManager) AttachLogger(ctx context.Context, containerID string, options container.AttachOptions) (types.HijackedResponse, error)

func (*ContainerManager) CopyToContainer

func (c *ContainerManager) CopyToContainer(ctx context.Context, containerID string, dest string, content io.Reader, options container.CopyToContainerOptions) error

func (*ContainerManager) CreateContainer

CreateContainer creates the job's container. netCfg is non-nil only when the job declares services, attaching it to the per-job service network.

func (*ContainerManager) CreateNetwork added in v0.2.1

func (c *ContainerManager) CreateNetwork(ctx context.Context, name, scope string) (string, error)

CreateNetwork creates the per-job bridge network services and the job attach to. The created_by label (scope) lets run-level cleanup sweep its own leftovers without touching other sessions'.

func (*ContainerManager) ExecProbe added in v0.2.1

func (c *ContainerManager) ExecProbe(ctx context.Context, containerID, cmd string) (int, error)

ExecProbe runs `/bin/sh -c cmd` inside a running container and returns its exit code. It backs service readiness checks (e.g. pg_isready).

func (*ContainerManager) InspectContainer added in v0.2.1

func (c *ContainerManager) InspectContainer(ctx context.Context, containerID string) (container.InspectResponse, error)

func (*ContainerManager) ListContainers added in v0.0.13

func (c *ContainerManager) ListContainers(ctx context.Context, options container.ListOptions) ([]container.Summary, error)

func (*ContainerManager) ListNetworks added in v0.2.1

func (c *ContainerManager) ListNetworks(ctx context.Context, options network.ListOptions) ([]network.Summary, error)

func (*ContainerManager) RemoveContainer

func (c *ContainerManager) RemoveContainer(ctx context.Context, containerID string, options container.RemoveOptions) error

func (*ContainerManager) RemoveContainerForce added in v0.2.1

func (c *ContainerManager) RemoveContainerForce(ctx context.Context, containerID string) error

RemoveContainerForce force-removes a container regardless of state.

func (*ContainerManager) RemoveNetwork added in v0.2.1

func (c *ContainerManager) RemoveNetwork(ctx context.Context, networkID string) error

func (*ContainerManager) StartContainer

func (c *ContainerManager) StartContainer(ctx context.Context, containerID string, options container.StartOptions) error

func (*ContainerManager) StopContainer

func (c *ContainerManager) StopContainer(ctx context.Context, containerID string, options container.StopOptions) error

func (*ContainerManager) WaitForContainer

func (c *ContainerManager) WaitForContainer(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

func NewDockerExecutor

func NewDockerExecutor(client *client.Client, adapter ConfigAdapter, logger *log.Logger) *Executor

func (*Executor) Close added in v0.2.1

func (e *Executor) Close() error

Close releases run-scoped resources (the artifact scratch dir). Callers should defer it right after constructing the executor.

func (*Executor) Execute

func (e *Executor) Execute(ctx context.Context, job config.JobConfig, out io.Writer) error

type ImageManager

type ImageManager struct {
	// contains filtered or unexported fields
}

func NewImageManager

func NewImageManager(cli *client.Client, adapter ConfigAdapter, logger *log.Logger) *ImageManager

func (*ImageManager) PullImage

func (i *ImageManager) PullImage(ctx context.Context, image string, options image.PullOptions) (io.ReadCloser, error)

type Status added in v0.2.0

type Status struct {
	Ready    bool   `json:"ready"`
	Provider string `json:"provider"`
	Version  string `json:"version"`
}

Status reports whether a local container engine is reachable and which one.

func Probe added in v0.2.0

func Probe(ctx context.Context) Status

Probe checks the local container engine: it connects using the standard environment (DOCKER_HOST etc.), asks the daemon for info, and identifies the provider (Docker, Docker Desktop, OrbStack, …). Ready is false — with the best guess at a provider name — when no daemon answers within a short timeout.

Jump to

Keyboard shortcuts

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