runtime

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package runtime defines the container backend abstraction used by the devcontainer engine.

The Runtime interface speaks containers and images only — it is deliberately ignorant of devcontainer-spec semantics (lifecycle phases, features, substitution). Spec semantics live in the parent devcontainer package; this layer is what swaps out for k8s, podman, or CLI-shim implementations in the future.

The Docker implementation lives in runtime/docker.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("runtime: not implemented")

ErrNotImplemented is returned by Runtime methods that have not yet been implemented for the chosen backend (e.g. BuildImage on a CLI-shim runtime in v1).

Functions

func CancellableCopy

func CancellableCopy(ctx context.Context, dst io.Writer, src io.ReadCloser) error

CancellableCopy copies src to dst until the copy completes or ctx is cancelled. On cancellation, src.Close() is called to break out of any blocking read, and ctx.Err() is returned.

This is the standard escape hatch for streaming Docker SDK calls (image pull, image build, follow logs) where ctx-driven cancellation is not honored at the socket-read boundary. Without it, ctx.Cancel() can hang for tens of seconds while the daemon stops sending bytes.

Types

type BuildEvent

type BuildEvent struct {
	Kind    BuildEventKind
	Message string
	LayerID string
	Digest  string
}

BuildEvent is a streaming progress message emitted during BuildImage or PullImage. Most fields are kind-specific; consumers should switch on Kind.

type BuildEventKind

type BuildEventKind string
const (
	BuildEventLog          BuildEventKind = "log"
	BuildEventLayer        BuildEventKind = "layer"
	BuildEventCompleted    BuildEventKind = "completed"
	BuildEventPullProgress BuildEventKind = "pull_progress"
)

type BuildSpec

type BuildSpec struct {
	ContextPath string
	Dockerfile  string
	Tag         string
	Args        map[string]string
	Target      string
	CacheFrom   []string
	NoCache     bool
	Platform    string
}

BuildSpec is the input to BuildImage.

type BuilderUnavailableError added in v0.2.0

type BuilderUnavailableError struct {
	// Hint is a backend-specific message telling the user how to
	// remediate (e.g. "run `container builder start`").
	Hint string
	Err  error
}

BuilderUnavailableError indicates the container engine's image-build component is missing or not running. Distinct from DaemonUnavailableError because the build engine is typically a separate process / VM that can be started independently (e.g. Apple's `container builder start`, Docker's BuildKit daemon).

func (*BuilderUnavailableError) Error added in v0.2.0

func (e *BuilderUnavailableError) Error() string

func (*BuilderUnavailableError) Unwrap added in v0.2.0

func (e *BuilderUnavailableError) Unwrap() error

type Capabilities added in v0.2.0

type Capabilities struct {
	// Healthchecks: backend honors HEALTHCHECK directives on
	// RunSpec/BuildSpec, and InspectContainer surfaces
	// State.Health.Status. Required for compose's
	// depends_on.<svc>.condition: service_healthy gating.
	//
	// Apple 0.12.x: false (apple/container #1502).
	Healthchecks bool

	// ExitCodes: InspectContainer returns the container's exit code
	// after Stop (ContainerDetails.ExitCode is meaningful for
	// state=exited). Required for compose's depends_on condition:
	// service_completed_successfully.
	//
	// Apple 0.12.x: false (apple/container #1501).
	ExitCodes bool

	// NamespaceSharing: backend supports network_mode / pid / ipc
	// set to service:<other> (Linux namespace sharing within one
	// kernel).
	//
	// Apple: architectural false — one VM per container means
	// separate kernels; namespace sharing is not implementable.
	NamespaceSharing bool

	// RestartPolicies: backend enforces compose's `restart:` field
	// via RunSpec or backend-equivalent. When false, the
	// orchestrator emits a single WarnRestartPolicyIgnoredOnBackend
	// event per Plan rather than refusing the project.
	//
	// Apple 0.12.x: false (apple/container #286).
	RestartPolicies bool

	// SharedVolumes: a single named volume can be concurrently
	// mounted into 2+ running containers. Apple's
	// ext4-on-disk-image volumes refuse multi-attach with
	// VZErrorDomain Code=2; Plan.Validate refuses such projects on
	// backends where this is false.
	//
	// Apple 0.12.x: false (apple/container #889).
	SharedVolumes bool

	// ServiceNameDNS: containers on the project network can resolve
	// peers by service name out of the box (compose's default
	// behavior). When false, the orchestrator falls back to a
	// post-start /etc/hosts patch driven by InspectContainer +
	// ExecContainer to seed the service→IP map.
	//
	// Apple 0.12.x: false (probe 3; apple/container #856 / 856
	// resolution upstream is open). The hosts-patch workaround
	// covers depends_on-declared edges; intra-level peers without a
	// depends_on edge race and may miss the patch on first DNS
	// lookup — documented limitation on this backend.
	ServiceNameDNS bool
}

Capabilities advertises optional features a backend implements. The compose orchestrator's plan validator (compose.Plan.Validate) keys feature gates off this struct so per-backend conditionals stay out of the validator. Backends self-describe; defaults are the docker baseline.

Each field documents the upstream issue (or status note) governing it so future contributors can tell at a glance which capabilities might flip true on the apple backend in the future. See design/compose-native.md §11.5 for the full provenance.

type ComposeDownSpec

type ComposeDownSpec struct {
	Files       []string
	ProjectName string
	WorkingDir  string

	// RemoveImages, when true, passes --rmi local (removes images
	// the project built locally; spares pulled images).
	RemoveImages bool

	// RemoveVolumes, when true, passes --volumes (removes named
	// volumes declared by the project plus anonymous volumes).
	RemoveVolumes bool
}

ComposeDownSpec configures ComposeDown.

type ComposeFailedError

type ComposeFailedError struct {
	Args     []string
	ExitCode int
	Stderr   string
}

ComposeFailedError wraps a non-zero exit from `docker compose`, preserving the captured stderr for diagnostics. Distinct from ComposeUnavailableError, which means the binary itself isn't there.

func (*ComposeFailedError) Error

func (e *ComposeFailedError) Error() string

type ComposePsSpec

type ComposePsSpec struct {
	Files       []string
	ProjectName string
	WorkingDir  string
}

ComposePsSpec configures ComposeContainerID.

type ComposeRuntime

type ComposeRuntime interface {
	// ComposeUp brings the project up in the background (-d).
	// Compose decides what to (re)build via its own logic; we feed it
	// override files that pin the primary service's image to a tag we
	// already built, so it does not rebuild that one.
	ComposeUp(ctx context.Context, spec ComposeUpSpec, events chan<- BuildEvent) error

	// ComposeDown stops and (optionally) removes the project's
	// containers, networks, and volumes.
	ComposeDown(ctx context.Context, spec ComposeDownSpec) error

	// ComposeContainerID returns the container id for a service in a
	// running project. Used by Engine.Up to pick out the primary
	// service's container after `compose up -d` settles. Returns
	// empty string if the service isn't running.
	ComposeContainerID(ctx context.Context, spec ComposePsSpec, service string) (string, error)
}

ComposeRuntime is the optional sub-interface a Runtime implements when it can drive a Docker Compose project. Engine.Up type-asserts this when handling *config.ComposeSource and returns runtime.ErrNotImplemented if the active runtime doesn't satisfy it.

All compose orchestration goes through these three calls plus a version probe (handled internally by the implementation). Container interaction (Exec, Inspect, Logs, lifecycle markers) stays on the regular Runtime methods, against the container id resolved by ComposeContainerID.

type ComposeUnavailableError

type ComposeUnavailableError struct {
	Err error
}

ComposeUnavailableError indicates the `docker compose` v2 plugin is not installed / not on PATH. Returned by ComposeRuntime methods on first attempted use; cached on the runtime so subsequent calls short-circuit with the same error.

func (*ComposeUnavailableError) Error

func (e *ComposeUnavailableError) Error() string

func (*ComposeUnavailableError) Unwrap

func (e *ComposeUnavailableError) Unwrap() error

type ComposeUpSpec

type ComposeUpSpec struct {
	// Files lists compose files in declaration order — user files
	// first, then our generated overrides (build, run). Each becomes
	// a `-f <path>` flag.
	Files []string

	// ProjectName is passed via -p / --project-name. Engine derives
	// it from the workspace id (`dc-<devcontainerId>` per PRD §12.5).
	ProjectName string

	// Services optionally restricts which services to start. Empty =
	// all services in the project (compose default).
	Services []string

	// WorkingDir is the directory `docker compose` runs in. Used as
	// the base for compose's relative-path resolution. Engine sets
	// this to the workspace folder.
	WorkingDir string

	// NoRecreate, when true, appends `--no-recreate` to the compose
	// invocation. Tells compose to keep an existing container even if
	// it thinks the config drifted — used on the resume path so we
	// don't destroy the container's writable layer (and anything in
	// $HOME inside it) on a spurious drift detection. Matches the
	// upstream devcontainers/cli gate (`container || expectExistingContainer`).
	NoRecreate bool
}

ComposeUpSpec configures ComposeUp.

type Container

type Container struct {
	ID    string
	Name  string
	Image string
	State State

	// Labels are populated by ListContainers and FindContainerByLabel
	// when the backend can surface them cheaply. RunContainer may
	// leave this nil; callers that need labels after a fresh create
	// should InspectContainer. The compose orchestrator reads this
	// to identify the service name during reverse-topo teardown.
	Labels map[string]string
}

Container is a minimal container handle returned by Run / Find / ListContainers. Use InspectContainer for fields not present here.

type ContainerDetails

type ContainerDetails struct {
	Container
	Created   time.Time
	StartedAt time.Time
	User      string
	Env       []string // KEY=VALUE pairs from the running container
	Mounts    []MountInspect
	Labels    map[string]string

	// ExitCode is the container's last exit code. Zero is ambiguous:
	// either "process is still running" or "process exited cleanly".
	// Use State to disambiguate (running vs exited).
	ExitCode int

	// FinishedAt is when the container's main process last exited. Zero
	// for never-exited containers.
	FinishedAt time.Time

	// Health reports the most recent HEALTHCHECK result.
	// HealthNone means the image declared no healthcheck (i.e. the
	// daemon never produced one); the compose orchestrator's
	// service_healthy gate treats this as "satisfied" so projects
	// without healthchecks still come up.
	Health HealthStatus
}

ContainerDetails is the full inspected state of a container.

type ContainerNotFoundError

type ContainerNotFoundError struct {
	ID  string
	Err error
}

ContainerNotFoundError indicates a container with the given id or name does not exist.

func (*ContainerNotFoundError) Error

func (e *ContainerNotFoundError) Error() string

func (*ContainerNotFoundError) Unwrap

func (e *ContainerNotFoundError) Unwrap() error

type DaemonUnavailableError

type DaemonUnavailableError struct {
	Err error
}

DaemonUnavailableError indicates the container engine daemon is unreachable (socket missing, permission denied, etc.).

func (*DaemonUnavailableError) Error

func (e *DaemonUnavailableError) Error() string

func (*DaemonUnavailableError) Unwrap

func (e *DaemonUnavailableError) Unwrap() error

type ExecFailedError

type ExecFailedError struct {
	ExitCode int
	Stderr   string
}

ExecFailedError indicates an exec call completed with a non-zero exit code. Captured stderr is included for diagnostics.

func (*ExecFailedError) Error

func (e *ExecFailedError) Error() string

type ExecOptions

type ExecOptions struct {
	Cmd        []string
	Env        map[string]string
	User       string
	WorkingDir string
	Tty        bool
	Stdin      io.Reader
	Stdout     io.Writer
	Stderr     io.Writer
}

ExecOptions configures an exec invocation. If Stdout/Stderr are nil, captured output is returned in ExecResult; otherwise output streams directly and ExecResult's Stdout/Stderr are empty.

type ExecResult

type ExecResult struct {
	ExitCode int
	Stdout   string // only populated if ExecOptions.Stdout was nil
	Stderr   string // only populated if ExecOptions.Stderr was nil
}

ExecResult is the outcome of ExecContainer.

type HealthCheckSpec added in v0.2.0

type HealthCheckSpec struct {
	Test          []string
	Interval      time.Duration
	Timeout       time.Duration
	Retries       int
	StartPeriod   time.Duration
	StartInterval time.Duration
	Disable       bool
}

HealthCheckSpec mirrors compose's healthcheck: directive plus docker's HEALTHCHECK config. Test is the command (with CMD/CMD-SHELL prefix as compose's HealthCheckTest already normalizes). Disable=true short-circuits to NONE, overriding any image-baked healthcheck.

type HealthStatus added in v0.2.0

type HealthStatus string

HealthStatus mirrors docker's container health-check states. Backends that don't surface a typed health value report HealthNone, which the compose orchestrator interprets as "no healthcheck declared" — semantically equivalent to docker's default for images without a HEALTHCHECK directive.

const (
	// HealthNone means the image / runtime did not surface a
	// healthcheck status. The orchestrator treats this as
	// satisfied (compose v2 behavior for healthcheck-less services).
	HealthNone HealthStatus = ""

	// HealthStarting is the daemon's transitional state — the
	// container is up but the healthcheck hasn't produced a verdict
	// yet. Orchestrator keeps polling.
	HealthStarting HealthStatus = "starting"

	// HealthHealthy means the most recent check passed.
	HealthHealthy HealthStatus = "healthy"

	// HealthUnhealthy means the most recent check failed. The
	// orchestrator surfaces this through *HealthTimeoutError if it
	// persists past the gate's deadline.
	HealthUnhealthy HealthStatus = "unhealthy"
)

type ImageDetails

type ImageDetails struct {
	ID     string
	Tags   []string
	Labels map[string]string
	Env    []string

	// User is the image's default USER directive (Config.User), or "" if
	// unset. Used to determine the effective container user for UID
	// reconciliation when devcontainer.json's remoteUser/containerUser
	// are also empty.
	User string
}

ImageDetails is the inspected state of a local image. Labels are the source of truth for the devcontainer.metadata pre-baked-image fast path.

type ImageNotFoundError

type ImageNotFoundError struct {
	Ref string
	Err error
}

ImageNotFoundError indicates the requested image is not present locally and could not be pulled.

func (*ImageNotFoundError) Error

func (e *ImageNotFoundError) Error() string

func (*ImageNotFoundError) Unwrap

func (e *ImageNotFoundError) Unwrap() error

type ImageRef

type ImageRef struct {
	ID   string // sha256:... digest
	Tags []string
}

ImageRef identifies an image by digest and any associated tags.

type LabelFilter added in v0.2.0

type LabelFilter struct {
	// Match is the AND set: every key must be present on the
	// resource AND its value must equal the requested value.
	// Implementations that lack server-side filtering (apple, per
	// design probe R1b) translate this client-side after enumeration.
	Match map[string]string
}

LabelFilter selects containers, images, or volumes by an AND of label key/value pairs. The Runtime contract requires non-empty; the orchestrator never wants to enumerate everything.

type MountInspect

type MountInspect struct {
	Type     string
	Source   string
	Target   string
	ReadOnly bool
}

MountInspect describes a mount as reported by the runtime, not what was requested. Differences (e.g. resolved volume name) reflect the daemon's view.

type MountSpec

type MountSpec struct {
	Type        MountType
	Source      string
	Target      string
	ReadOnly    bool
	Propagation string // host bind consistency: "consistent" | "cached" | "delegated" | "" (Linux default)
}

MountSpec is a request for a single mount on a container.

type MountType

type MountType string
const (
	MountBind   MountType = "bind"
	MountVolume MountType = "volume"
	MountTmpfs  MountType = "tmpfs"
)

type NetworkSpec added in v0.2.0

type NetworkSpec struct {
	// Name is the user-facing network name (e.g. dc-<id>_default).
	// Backends namespace internally if their model requires it; the
	// returned ID is what callers store for later RemoveNetwork.
	Name string

	// Labels are stamped on the network for identification at
	// teardown. The orchestrator uses com.docker.compose.project +
	// dev.containers.engine labels exclusively; backends pass them
	// through verbatim.
	Labels map[string]string

	// Driver selects the backend's network driver. Empty string means
	// "backend default" (bridge on docker; vmnet-based default on
	// apple). Non-default drivers are out of scope for v1.
	Driver string

	// Options is the driver-options string map (compose's
	// driver_opts:). Pass-through; backends may reject unknown keys
	// with a typed error.
	Options map[string]string
}

NetworkSpec describes a user-defined network to create. The compose orchestrator creates exactly one project network per Up (<project>_default) plus any volumes; multi-network compose projects are §2.2 refused (see design/compose-native.md).

type PortBinding added in v0.2.0

type PortBinding struct {
	// HostIP optionally restricts the bind to a specific host
	// address. Empty = all interfaces (docker's 0.0.0.0 default).
	HostIP string

	// HostPort is the host-side port. Empty = let the daemon pick
	// (docker assigns from the ephemeral range).
	HostPort string

	// ContainerPort is the in-container port that's being
	// published. Required.
	ContainerPort int

	// Protocol is "tcp" or "udp". Empty defaults to "tcp".
	Protocol string
}

PortBinding describes a host->container port publish. Translates to docker's HostConfig.PortBindings + Config.ExposedPorts on the docker backend. Other backends translate where possible; an unsupported PortBinding on a backend that can't model it is the backend's choice to error or pass through.

type RemoveOptions

type RemoveOptions struct {
	Force         bool
	RemoveVolumes bool
}

RemoveOptions configures RemoveContainer.

type RestartPolicy added in v0.2.0

type RestartPolicy string

RestartPolicy controls auto-restart behavior of a container. Mirrors docker compose's `restart:` directive values.

const (
	RestartNo            RestartPolicy = ""
	RestartAlways        RestartPolicy = "always"
	RestartOnFailure     RestartPolicy = "on-failure"
	RestartUnlessStopped RestartPolicy = "unless-stopped"
)

type RunSpec

type RunSpec struct {
	Image      string
	Name       string
	Cmd        []string
	Entrypoint []string

	User       string
	WorkingDir string
	Env        map[string]string
	Labels     map[string]string

	Mounts []MountSpec

	// RunArgs is a list of additional Docker CLI-style flags (e.g.
	// "--add-host=host:ip"). Implementations parse and apply where
	// supported; unsupported flags become warnings, not errors.
	RunArgs []string

	Init        bool
	Privileged  bool
	CapAdd      []string
	SecurityOpt []string

	// HealthCheck declares the HEALTHCHECK directive at create time.
	// Nil means inherit from the image (i.e. no override). Used by
	// the compose orchestrator to translate `healthcheck:` directives.
	HealthCheck *HealthCheckSpec

	// Networks lists project networks the container joins. Empty
	// means "backend default" — docker assigns the default bridge;
	// apple assigns the built-in vmnet network. Used by the compose
	// orchestrator to attach services to the project network it
	// just created via CreateNetwork.
	Networks []string

	// Ports lists the ports this container publishes to the host.
	// Empty means no publishing (the container's ports are reachable
	// inside the project network but not from the host). Used by
	// the compose orchestrator to translate `ports:` directives.
	Ports []PortBinding

	// RestartPolicy controls whether the runtime restarts the
	// container on exit. Zero-value (RestartNo) matches docker's
	// `no` default. Used by the compose orchestrator to translate
	// `restart:` directives.
	RestartPolicy RestartPolicy

	// OverrideCommand, when true, forces Cmd to be ["/bin/sh","-c","while sleep 1000; do :; done"]
	// so the container stays alive for exec-based interaction. Spec default true.
	OverrideCommand bool

	// MemoryBytes is the hard memory limit for the container, in bytes.
	// Zero means "unset": the backend's own default applies — for docker
	// that's no cgroup limit; for apple it's the apiserver's per-VM
	// default (1 GiB on 0.12.x). Negative values are rejected by the
	// backend.
	//
	// On apple, this sizes the per-container VM at boot; the guest
	// kernel sees exactly this much memory and the value cannot be
	// resized without container recreation. On docker, this maps to
	// HostConfig.Memory and is enforced by cgroups.
	MemoryBytes int64

	// NanoCPUs is the CPU limit expressed in nano-units: 1_000_000_000
	// = one full CPU, 2_500_000_000 = 2.5 CPUs. Matches docker's
	// HostConfig.NanoCPUs convention so a single field works across
	// backends. Zero means "unset". Apple's apiserver takes an integer
	// CPU count, so the value is rounded up to the next whole CPU at
	// the bridge boundary (e.g. 1_500_000_000 → 2 cpus).
	NanoCPUs int64
}

RunSpec is the input to RunContainer.

type Runtime

type Runtime interface {
	// BuildImage builds an image from a build spec and returns its
	// reference. Build progress is streamed on events (best-effort; events
	// may be dropped if the channel is full).
	BuildImage(ctx context.Context, spec BuildSpec, events chan<- BuildEvent) (ImageRef, error)

	// PullImage fetches an image from a registry, returning its reference.
	// Pull progress is streamed on events.
	PullImage(ctx context.Context, ref string, events chan<- BuildEvent) (ImageRef, error)

	// RunContainer creates a container from a run spec. The container is
	// not started — call StartContainer when ready. Splitting create from
	// start lets callers attach hooks (e.g. mark files) between phases.
	RunContainer(ctx context.Context, spec RunSpec) (*Container, error)

	// StartContainer starts a previously created container.
	StartContainer(ctx context.Context, id string) error

	// StopContainer stops a running container, waiting up to opts.Timeout
	// for graceful shutdown before SIGKILL.
	StopContainer(ctx context.Context, id string, opts StopOptions) error

	// RemoveContainer removes a container. The container must be stopped
	// unless opts.Force is set.
	RemoveContainer(ctx context.Context, id string, opts RemoveOptions) error

	// ExecContainer runs a command inside a running container. If
	// opts.Stdout / Stderr are nil, output is captured into ExecResult.
	ExecContainer(ctx context.Context, id string, opts ExecOptions) (ExecResult, error)

	// InspectContainer returns full details for a container, including
	// the live env (used for ${containerEnv:*} substitution).
	InspectContainer(ctx context.Context, id string) (*ContainerDetails, error)

	// InspectImage returns the image's labels, env, and other config.
	// Used by the engine to read the devcontainer.metadata label off
	// pre-baked images and skip already-installed features.
	InspectImage(ctx context.Context, ref string) (*ImageDetails, error)

	// ContainerLogs streams the container's stdout+stderr to w. If follow
	// is true, the call blocks until ctx is cancelled or the container exits.
	ContainerLogs(ctx context.Context, id string, w io.Writer, follow bool) error

	// FindContainerByLabel returns the most recently created container
	// matching the given label. Returns nil, nil if no match.
	FindContainerByLabel(ctx context.Context, key, value string) (*Container, error)

	// CreateNetwork creates a network with the given name and
	// labels. Returns the backend's network ID for later
	// RemoveNetwork. Idempotent on (name, labels) match: if a
	// network with the same name and matching label set already
	// exists, return its ID without error (same shape as compose's
	// own up behavior).
	CreateNetwork(ctx context.Context, spec NetworkSpec) (string, error)

	// RemoveNetwork removes a network by its backend ID. No-op if
	// the network is already gone.
	RemoveNetwork(ctx context.Context, id string) error

	// CreateVolume creates a named volume. Idempotent on (name,
	// labels). Returns the backend's volume identifier — usually
	// the name itself, but backends may translate.
	CreateVolume(ctx context.Context, spec VolumeSpec) (string, error)

	// RemoveVolume removes a named volume. No-op if missing.
	RemoveVolume(ctx context.Context, name string) error

	// ListContainers returns containers matching every label in the
	// filter. Empty filter is rejected — we never want to enumerate
	// all containers. Implementations without server-side filtering
	// (e.g. applecontainer per design probe R1b) filter client-side
	// after a full enumeration.
	ListContainers(ctx context.Context, filter LabelFilter) ([]Container, error)

	// ListImages returns local images matching the filter. Used by
	// Down --rmi local: built images are stamped with project labels
	// so teardown can prune by label. Same empty-filter rule as
	// ListContainers.
	ListImages(ctx context.Context, filter LabelFilter) ([]ImageRef, error)

	// RemoveImage removes a local image by ID or reference. No-op
	// if missing.
	RemoveImage(ctx context.Context, ref string) error

	// Capabilities advertises optional features this backend
	// supports. compose.Plan.Validate keys feature gates off this
	// struct so per-backend conditionals stay out of the validator.
	// The returned value should be a constant for the lifetime of
	// the Runtime; callers may cache it.
	Capabilities() Capabilities
}

Runtime is the container backend. Implementations must be safe for concurrent use; the engine may issue concurrent Inspect / Exec calls against the same container.

type State

type State string

State is the container lifecycle state per Docker Engine API.

const (
	StateCreated    State = "created"
	StateRunning    State = "running"
	StatePaused     State = "paused"
	StateRestarting State = "restarting"
	StateRemoving   State = "removing"
	StateExited     State = "exited"
	StateDead       State = "dead"
)

type StopOptions

type StopOptions struct {
	Timeout time.Duration // grace period before SIGKILL; 0 = engine default
}

StopOptions configures StopContainer.

type UnsupportedOptionError added in v0.2.0

type UnsupportedOptionError struct {
	Backend string
	Option  string
}

UnsupportedOptionError indicates a RunSpec / BuildSpec field that the chosen backend cannot honor. Returned at the boundary instead of silently dropping the option, so callers fail fast rather than observing apparent success with missing behavior.

func (*UnsupportedOptionError) Error added in v0.2.0

func (e *UnsupportedOptionError) Error() string

type VolumeSpec added in v0.2.0

type VolumeSpec struct {
	// Name is the user-facing volume name (e.g. dc-<id>_<volname>).
	// Backends translate to whatever their native naming requires.
	Name string

	// Labels for teardown lookup. Same convention as NetworkSpec.
	Labels map[string]string

	// Driver selects the backend's volume driver. Empty = backend
	// default (local on docker; the file-backed driver on apple).
	Driver string

	// Options is the driver-options string map. Pass-through.
	Options map[string]string
}

VolumeSpec describes a named volume to create. The orchestrator creates one per top-level compose `volumes:` entry actually referenced by a service. Anonymous volumes are handled at RunSpec.Mounts time, not here.

Directories

Path Synopsis
Package applecontainer is an Apple `container` implementation of runtime.Runtime targeting macOS 15+ on arm64.
Package applecontainer is an Apple `container` implementation of runtime.Runtime targeting macOS 15+ on arm64.
Package docker is a Docker Engine API implementation of runtime.Runtime.
Package docker is a Docker Engine API implementation of runtime.Runtime.

Jump to

Keyboard shortcuts

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