Documentation
¶
Index ¶
- func IsTerminal() bool
- func LogsFlags(opts LogsOptions) []string
- type ContainerInfo
- type Engine
- func (e *Engine) BinaryPath() string
- func (e *Engine) ContainerExec(ctx context.Context, nameOrID string, args []string, interactive bool) error
- func (e *Engine) ContainerInspect(ctx context.Context, nameOrID string) ([]byte, error)
- func (e *Engine) ContainerList(ctx context.Context, all bool) ([]ContainerInfo, error)
- func (e *Engine) ContainerLogs(ctx context.Context, nameOrID string, opts LogsOptions) error
- func (e *Engine) ContainerRemove(ctx context.Context, nameOrID string, force bool) error
- func (e *Engine) ContainerRun(ctx context.Context, args []string, interactive bool) error
- func (e *Engine) ContainerStart(ctx context.Context, nameOrID string) error
- func (e *Engine) ContainerStop(ctx context.Context, nameOrID string) error
- func (e *Engine) EnsureSystemRunning(ctx context.Context) error
- func (e *Engine) Exec(ctx context.Context, args ...string) ([]byte, []byte, error)
- func (e *Engine) ExecInteractive(ctx context.Context, args ...string) error
- func (e *Engine) ExecStream(ctx context.Context, args ...string) (io.ReadCloser, error)
- func (e *Engine) ExecStreamSplit(ctx context.Context, args ...string) (io.ReadCloser, io.ReadCloser, error)
- func (e *Engine) ImageBuild(ctx context.Context, args []string) error
- func (e *Engine) ImageList(ctx context.Context) ([]ImageInfo, error)
- func (e *Engine) ImagePull(ctx context.Context, image string, opts ImagePullOpts) error
- func (e *Engine) ImagePush(ctx context.Context, image string) error
- func (e *Engine) ImageRemove(ctx context.Context, image string) error
- func (e *Engine) NetworkConnect(ctx context.Context, network, container string) error
- func (e *Engine) NetworkCreate(ctx context.Context, name string, labels map[string]string) error
- func (e *Engine) NetworkDisconnect(ctx context.Context, network, container string) error
- func (e *Engine) NetworkInspect(ctx context.Context, name string) ([]byte, error)
- func (e *Engine) NetworkList(ctx context.Context) ([]NetworkInfo, error)
- func (e *Engine) NetworkRemove(ctx context.Context, name string) error
- func (e *Engine) Validate() error
- func (e *Engine) VolumeCreate(ctx context.Context, name string) error
- func (e *Engine) VolumeInspect(ctx context.Context, name string) ([]byte, error)
- func (e *Engine) VolumeList(ctx context.Context) ([]VolumeInfo, error)
- func (e *Engine) VolumeRemove(ctx context.Context, name string) error
- type ImageInfo
- type ImagePullOpts
- type InspectData
- type LogsOptions
- type MockRuntime
- func (m *MockRuntime) BinaryPath() string
- func (m *MockRuntime) ContainerExec(ctx context.Context, nameOrID string, args []string, interactive bool) error
- func (m *MockRuntime) ContainerInspect(ctx context.Context, nameOrID string) ([]byte, error)
- func (m *MockRuntime) ContainerList(ctx context.Context, all bool) ([]ContainerInfo, error)
- func (m *MockRuntime) ContainerLogs(ctx context.Context, nameOrID string, opts LogsOptions) error
- func (m *MockRuntime) ContainerRemove(ctx context.Context, nameOrID string, force bool) error
- func (m *MockRuntime) ContainerRun(ctx context.Context, args []string, interactive bool) error
- func (m *MockRuntime) ContainerStart(ctx context.Context, nameOrID string) error
- func (m *MockRuntime) ContainerStop(ctx context.Context, nameOrID string) error
- func (m *MockRuntime) Exec(ctx context.Context, args ...string) ([]byte, []byte, error)
- func (m *MockRuntime) ExecInteractive(ctx context.Context, args ...string) error
- func (m *MockRuntime) ExecStream(ctx context.Context, args ...string) (io.ReadCloser, error)
- func (m *MockRuntime) ExecStreamSplit(ctx context.Context, args ...string) (io.ReadCloser, io.ReadCloser, error)
- func (m *MockRuntime) ImageBuild(ctx context.Context, args []string) error
- func (m *MockRuntime) ImageList(ctx context.Context) ([]ImageInfo, error)
- func (m *MockRuntime) ImagePull(ctx context.Context, image string, opts ImagePullOpts) error
- func (m *MockRuntime) ImagePush(ctx context.Context, image string) error
- func (m *MockRuntime) ImageRemove(ctx context.Context, image string) error
- func (m *MockRuntime) NetworkConnect(ctx context.Context, network, container string) error
- func (m *MockRuntime) NetworkCreate(ctx context.Context, name string, labels map[string]string) error
- func (m *MockRuntime) NetworkDisconnect(ctx context.Context, network, container string) error
- func (m *MockRuntime) NetworkInspect(ctx context.Context, name string) ([]byte, error)
- func (m *MockRuntime) NetworkList(ctx context.Context) ([]NetworkInfo, error)
- func (m *MockRuntime) NetworkRemove(ctx context.Context, name string) error
- func (m *MockRuntime) Validate() error
- func (m *MockRuntime) VolumeCreate(ctx context.Context, name string) error
- func (m *MockRuntime) VolumeInspect(ctx context.Context, name string) ([]byte, error)
- func (m *MockRuntime) VolumeList(ctx context.Context) ([]VolumeInfo, error)
- func (m *MockRuntime) VolumeRemove(ctx context.Context, name string) error
- type NerdctlRuntime
- func (n *NerdctlRuntime) BinaryPath() string
- func (n *NerdctlRuntime) ContainerExec(ctx context.Context, nameOrID string, args []string, interactive bool) error
- func (n *NerdctlRuntime) ContainerInspect(ctx context.Context, nameOrID string) ([]byte, error)
- func (n *NerdctlRuntime) ContainerList(ctx context.Context, all bool) ([]ContainerInfo, error)
- func (n *NerdctlRuntime) ContainerLogs(ctx context.Context, nameOrID string, opts LogsOptions) error
- func (n *NerdctlRuntime) ContainerRemove(ctx context.Context, nameOrID string, force bool) error
- func (n *NerdctlRuntime) ContainerRun(ctx context.Context, args []string, interactive bool) error
- func (n *NerdctlRuntime) ContainerStart(ctx context.Context, nameOrID string) error
- func (n *NerdctlRuntime) ContainerStop(ctx context.Context, nameOrID string) error
- func (n *NerdctlRuntime) Exec(ctx context.Context, args ...string) ([]byte, []byte, error)
- func (n *NerdctlRuntime) ExecInteractive(ctx context.Context, args ...string) error
- func (n *NerdctlRuntime) ExecStream(ctx context.Context, args ...string) (io.ReadCloser, error)
- func (n *NerdctlRuntime) ExecStreamSplit(ctx context.Context, args ...string) (io.ReadCloser, io.ReadCloser, error)
- func (n *NerdctlRuntime) ImageBuild(ctx context.Context, args []string) error
- func (n *NerdctlRuntime) ImageList(ctx context.Context) ([]ImageInfo, error)
- func (n *NerdctlRuntime) ImagePull(ctx context.Context, image string, opts ImagePullOpts) error
- func (n *NerdctlRuntime) ImagePush(ctx context.Context, image string) error
- func (n *NerdctlRuntime) ImageRemove(ctx context.Context, image string) error
- func (n *NerdctlRuntime) NetworkConnect(ctx context.Context, network, container string) error
- func (n *NerdctlRuntime) NetworkCreate(ctx context.Context, name string, labels map[string]string) error
- func (n *NerdctlRuntime) NetworkDisconnect(ctx context.Context, network, container string) error
- func (n *NerdctlRuntime) NetworkInspect(ctx context.Context, name string) ([]byte, error)
- func (n *NerdctlRuntime) NetworkList(ctx context.Context) ([]NetworkInfo, error)
- func (n *NerdctlRuntime) NetworkRemove(ctx context.Context, name string) error
- func (n *NerdctlRuntime) Validate() error
- func (n *NerdctlRuntime) VolumeCreate(ctx context.Context, name string) error
- func (n *NerdctlRuntime) VolumeInspect(ctx context.Context, name string) ([]byte, error)
- func (n *NerdctlRuntime) VolumeList(ctx context.Context) ([]VolumeInfo, error)
- func (n *NerdctlRuntime) VolumeRemove(ctx context.Context, name string) error
- type NetworkInfo
- type Runtime
- type VolumeInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTerminal ¶ added in v0.6.0
func IsTerminal() bool
IsTerminal reports whether stdin is connected to a terminal.
func LogsFlags ¶ added in v0.7.8
func LogsFlags(opts LogsOptions) []string
LogsFlags renders LogsOptions as CLI flags compatible with both Apple's `container logs` and `nerdctl logs`.
Types ¶
type ContainerInfo ¶
type ContainerInfo struct {
ID string
Name string
Image string
State string
Status string
IP string
Ports string
Created time.Time
Command string
// Labels set at create time. Compose reads
// com.docker.compose.{project,service,oneoff,config-hash} off list
// responses to scope `docker compose ps` to its own project and fill
// the Service column. Missing labels → blank service name and compose
// treats the container as foreign.
Labels map[string]string
}
func ParseNerdctlContainerList ¶ added in v0.4.0
func ParseNerdctlContainerList(data []byte) ([]ContainerInfo, error)
type Engine ¶
type Engine struct {
Binary string
}
Engine is the Apple Container CLI backend (macOS).
func (*Engine) BinaryPath ¶ added in v0.4.0
func (*Engine) ContainerExec ¶
func (*Engine) ContainerInspect ¶
func (*Engine) ContainerList ¶
func (*Engine) ContainerLogs ¶
func (*Engine) ContainerRemove ¶
func (*Engine) ContainerRun ¶
func (*Engine) ContainerStart ¶
func (*Engine) ContainerStop ¶
func (*Engine) EnsureSystemRunning ¶ added in v0.5.0
EnsureSystemRunning checks whether the Apple Container system service is active and starts it automatically if it isn't. This prevents the confusing "XPC connection error: Connection invalid" message users see when the service has been stopped (e.g. after a reboot).
func (*Engine) ExecInteractive ¶
func (*Engine) ExecStream ¶
func (*Engine) ExecStreamSplit ¶ added in v0.7.8
func (e *Engine) ExecStreamSplit(ctx context.Context, args ...string) (io.ReadCloser, io.ReadCloser, error)
func (*Engine) NetworkConnect ¶
func (*Engine) NetworkCreate ¶
func (*Engine) NetworkDisconnect ¶
func (*Engine) NetworkInspect ¶
func (*Engine) NetworkList ¶
func (e *Engine) NetworkList(ctx context.Context) ([]NetworkInfo, error)
func (*Engine) NetworkRemove ¶
func (*Engine) VolumeInspect ¶
func (*Engine) VolumeList ¶
func (e *Engine) VolumeList(ctx context.Context) ([]VolumeInfo, error)
type ImageInfo ¶
type ImageInfo struct {
ID string
Name string
Tag string
Digest string
Size string
Created time.Time
Arch string
}
func ParseNerdctlImageList ¶ added in v0.4.0
type ImagePullOpts ¶ added in v0.7.0
type ImagePullOpts struct {
// Platform restricts the pull to a single platform, e.g. "linux/arm64".
// Empty string uses the backend default (typically host architecture).
Platform string
// MaxConcurrent caps the number of layers downloaded in parallel.
// 0 uses the backend default (Apple container CLI: 3). Only honored by
// backends that expose this at the CLI — nerdctl does not.
MaxConcurrent int
// Progress selects the progress renderer: "ansi", "none", or "" for
// auto-detect (ansi when stdout is a TTY, none otherwise). Prevents
// ANSI redraw escape codes from cluttering piped/CI output.
Progress string
}
ImagePullOpts controls image pull behavior. The zero value uses backend defaults.
type InspectData ¶
type InspectData struct {
Raw []byte // raw JSON from `container inspect`
}
type LogsOptions ¶ added in v0.7.8
type LogsOptions struct {
Follow bool
Tail string // "all" or a number; empty = backend default
Since string // RFC3339 timestamp or duration like "10m"
Until string // RFC3339 timestamp or duration
Timestamps bool
}
LogsOptions controls container log retrieval. Zero value: full backlog, no follow.
type MockRuntime ¶ added in v0.5.0
type MockRuntime struct {
ValidateFunc func() error
BinaryPathFunc func() string
ExecFunc func(ctx context.Context, args ...string) ([]byte, []byte, error)
ExecInteractiveFunc func(ctx context.Context, args ...string) error
ExecStreamFunc func(ctx context.Context, args ...string) (io.ReadCloser, error)
ContainerRunFunc func(ctx context.Context, args []string, interactive bool) error
ContainerListFunc func(ctx context.Context, all bool) ([]ContainerInfo, error)
ContainerStopFunc func(ctx context.Context, nameOrID string) error
ContainerStartFunc func(ctx context.Context, nameOrID string) error
ContainerRemoveFunc func(ctx context.Context, nameOrID string, force bool) error
ContainerExecFunc func(ctx context.Context, nameOrID string, args []string, interactive bool) error
ContainerLogsFunc func(ctx context.Context, nameOrID string, opts LogsOptions) error
ContainerInspectFunc func(ctx context.Context, nameOrID string) ([]byte, error)
ImagePullFunc func(ctx context.Context, image string, opts ImagePullOpts) error
ImagePushFunc func(ctx context.Context, image string) error
ImageListFunc func(ctx context.Context) ([]ImageInfo, error)
ImageRemoveFunc func(ctx context.Context, image string) error
ImageBuildFunc func(ctx context.Context, args []string) error
NetworkCreateFunc func(ctx context.Context, name string, labels map[string]string) error
NetworkListFunc func(ctx context.Context) ([]NetworkInfo, error)
NetworkRemoveFunc func(ctx context.Context, name string) error
NetworkConnectFunc func(ctx context.Context, network, container string) error
NetworkDisconnectFunc func(ctx context.Context, network, container string) error
NetworkInspectFunc func(ctx context.Context, name string) ([]byte, error)
VolumeCreateFunc func(ctx context.Context, name string) error
VolumeListFunc func(ctx context.Context) ([]VolumeInfo, error)
VolumeRemoveFunc func(ctx context.Context, name string) error
VolumeInspectFunc func(ctx context.Context, name string) ([]byte, error)
}
MockRuntime is a test double for the Runtime interface. Each method delegates to its corresponding function field. If a field is nil the method panics, except BinaryPath which returns "/mock/binary".
func (*MockRuntime) BinaryPath ¶ added in v0.5.0
func (m *MockRuntime) BinaryPath() string
func (*MockRuntime) ContainerExec ¶ added in v0.5.0
func (*MockRuntime) ContainerInspect ¶ added in v0.5.0
func (*MockRuntime) ContainerList ¶ added in v0.5.0
func (m *MockRuntime) ContainerList(ctx context.Context, all bool) ([]ContainerInfo, error)
func (*MockRuntime) ContainerLogs ¶ added in v0.5.0
func (m *MockRuntime) ContainerLogs(ctx context.Context, nameOrID string, opts LogsOptions) error
func (*MockRuntime) ContainerRemove ¶ added in v0.5.0
func (*MockRuntime) ContainerRun ¶ added in v0.5.0
func (*MockRuntime) ContainerStart ¶ added in v0.5.0
func (m *MockRuntime) ContainerStart(ctx context.Context, nameOrID string) error
func (*MockRuntime) ContainerStop ¶ added in v0.5.0
func (m *MockRuntime) ContainerStop(ctx context.Context, nameOrID string) error
func (*MockRuntime) ExecInteractive ¶ added in v0.5.0
func (m *MockRuntime) ExecInteractive(ctx context.Context, args ...string) error
func (*MockRuntime) ExecStream ¶ added in v0.5.0
func (m *MockRuntime) ExecStream(ctx context.Context, args ...string) (io.ReadCloser, error)
func (*MockRuntime) ExecStreamSplit ¶ added in v0.7.8
func (m *MockRuntime) ExecStreamSplit(ctx context.Context, args ...string) (io.ReadCloser, io.ReadCloser, error)
func (*MockRuntime) ImageBuild ¶ added in v0.5.0
func (m *MockRuntime) ImageBuild(ctx context.Context, args []string) error
func (*MockRuntime) ImageList ¶ added in v0.5.0
func (m *MockRuntime) ImageList(ctx context.Context) ([]ImageInfo, error)
func (*MockRuntime) ImagePull ¶ added in v0.5.0
func (m *MockRuntime) ImagePull(ctx context.Context, image string, opts ImagePullOpts) error
func (*MockRuntime) ImagePush ¶ added in v0.5.0
func (m *MockRuntime) ImagePush(ctx context.Context, image string) error
func (*MockRuntime) ImageRemove ¶ added in v0.5.0
func (m *MockRuntime) ImageRemove(ctx context.Context, image string) error
func (*MockRuntime) NetworkConnect ¶ added in v0.5.0
func (m *MockRuntime) NetworkConnect(ctx context.Context, network, container string) error
func (*MockRuntime) NetworkCreate ¶ added in v0.5.0
func (*MockRuntime) NetworkDisconnect ¶ added in v0.5.0
func (m *MockRuntime) NetworkDisconnect(ctx context.Context, network, container string) error
func (*MockRuntime) NetworkInspect ¶ added in v0.5.0
func (*MockRuntime) NetworkList ¶ added in v0.5.0
func (m *MockRuntime) NetworkList(ctx context.Context) ([]NetworkInfo, error)
func (*MockRuntime) NetworkRemove ¶ added in v0.5.0
func (m *MockRuntime) NetworkRemove(ctx context.Context, name string) error
func (*MockRuntime) Validate ¶ added in v0.5.0
func (m *MockRuntime) Validate() error
func (*MockRuntime) VolumeCreate ¶ added in v0.5.0
func (m *MockRuntime) VolumeCreate(ctx context.Context, name string) error
func (*MockRuntime) VolumeInspect ¶ added in v0.5.0
func (*MockRuntime) VolumeList ¶ added in v0.5.0
func (m *MockRuntime) VolumeList(ctx context.Context) ([]VolumeInfo, error)
func (*MockRuntime) VolumeRemove ¶ added in v0.5.0
func (m *MockRuntime) VolumeRemove(ctx context.Context, name string) error
type NerdctlRuntime ¶ added in v0.4.0
type NerdctlRuntime struct {
Binary string
}
NerdctlRuntime is the containerd/nerdctl backend (Linux).
func NewNerdctl ¶ added in v0.4.0
func NewNerdctl(binary string) *NerdctlRuntime
func (*NerdctlRuntime) BinaryPath ¶ added in v0.4.0
func (n *NerdctlRuntime) BinaryPath() string
func (*NerdctlRuntime) ContainerExec ¶ added in v0.4.0
func (*NerdctlRuntime) ContainerInspect ¶ added in v0.4.0
func (*NerdctlRuntime) ContainerList ¶ added in v0.4.0
func (n *NerdctlRuntime) ContainerList(ctx context.Context, all bool) ([]ContainerInfo, error)
func (*NerdctlRuntime) ContainerLogs ¶ added in v0.4.0
func (n *NerdctlRuntime) ContainerLogs(ctx context.Context, nameOrID string, opts LogsOptions) error
func (*NerdctlRuntime) ContainerRemove ¶ added in v0.4.0
func (*NerdctlRuntime) ContainerRun ¶ added in v0.4.0
func (*NerdctlRuntime) ContainerStart ¶ added in v0.4.0
func (n *NerdctlRuntime) ContainerStart(ctx context.Context, nameOrID string) error
func (*NerdctlRuntime) ContainerStop ¶ added in v0.4.0
func (n *NerdctlRuntime) ContainerStop(ctx context.Context, nameOrID string) error
func (*NerdctlRuntime) ExecInteractive ¶ added in v0.4.0
func (n *NerdctlRuntime) ExecInteractive(ctx context.Context, args ...string) error
func (*NerdctlRuntime) ExecStream ¶ added in v0.4.0
func (n *NerdctlRuntime) ExecStream(ctx context.Context, args ...string) (io.ReadCloser, error)
func (*NerdctlRuntime) ExecStreamSplit ¶ added in v0.7.8
func (n *NerdctlRuntime) ExecStreamSplit(ctx context.Context, args ...string) (io.ReadCloser, io.ReadCloser, error)
func (*NerdctlRuntime) ImageBuild ¶ added in v0.4.0
func (n *NerdctlRuntime) ImageBuild(ctx context.Context, args []string) error
func (*NerdctlRuntime) ImageList ¶ added in v0.4.0
func (n *NerdctlRuntime) ImageList(ctx context.Context) ([]ImageInfo, error)
func (*NerdctlRuntime) ImagePull ¶ added in v0.4.0
func (n *NerdctlRuntime) ImagePull(ctx context.Context, image string, opts ImagePullOpts) error
func (*NerdctlRuntime) ImagePush ¶ added in v0.4.0
func (n *NerdctlRuntime) ImagePush(ctx context.Context, image string) error
func (*NerdctlRuntime) ImageRemove ¶ added in v0.4.0
func (n *NerdctlRuntime) ImageRemove(ctx context.Context, image string) error
func (*NerdctlRuntime) NetworkConnect ¶ added in v0.4.0
func (n *NerdctlRuntime) NetworkConnect(ctx context.Context, network, container string) error
func (*NerdctlRuntime) NetworkCreate ¶ added in v0.4.0
func (*NerdctlRuntime) NetworkDisconnect ¶ added in v0.4.0
func (n *NerdctlRuntime) NetworkDisconnect(ctx context.Context, network, container string) error
func (*NerdctlRuntime) NetworkInspect ¶ added in v0.4.0
func (*NerdctlRuntime) NetworkList ¶ added in v0.4.0
func (n *NerdctlRuntime) NetworkList(ctx context.Context) ([]NetworkInfo, error)
func (*NerdctlRuntime) NetworkRemove ¶ added in v0.4.0
func (n *NerdctlRuntime) NetworkRemove(ctx context.Context, name string) error
func (*NerdctlRuntime) Validate ¶ added in v0.4.0
func (n *NerdctlRuntime) Validate() error
func (*NerdctlRuntime) VolumeCreate ¶ added in v0.4.0
func (n *NerdctlRuntime) VolumeCreate(ctx context.Context, name string) error
func (*NerdctlRuntime) VolumeInspect ¶ added in v0.4.0
func (*NerdctlRuntime) VolumeList ¶ added in v0.4.0
func (n *NerdctlRuntime) VolumeList(ctx context.Context) ([]VolumeInfo, error)
func (*NerdctlRuntime) VolumeRemove ¶ added in v0.4.0
func (n *NerdctlRuntime) VolumeRemove(ctx context.Context, name string) error
type NetworkInfo ¶
type NetworkInfo struct {
ID string
Name string
Driver string
Scope string
// Labels are the resource labels set at create time. Critical for
// Docker Compose compatibility: compose reads
// com.docker.compose.project to decide whether a network is "its own"
// vs foreign. Returning empty labels causes compose to refuse its own
// networks with "not created by Docker Compose".
Labels map[string]string
}
func ParseNerdctlNetworkList ¶ added in v0.4.0
func ParseNerdctlNetworkList(data []byte) ([]NetworkInfo, error)
type Runtime ¶ added in v0.4.0
type Runtime interface {
// Validate checks that the backend binary exists and is usable.
Validate() error
// BinaryPath returns the path to the underlying runtime binary.
BinaryPath() string
// Low-level exec — used by API server and commands that need raw CLI access.
Exec(ctx context.Context, args ...string) ([]byte, []byte, error)
ExecInteractive(ctx context.Context, args ...string) error
ExecStream(ctx context.Context, args ...string) (io.ReadCloser, error)
ExecStreamSplit(ctx context.Context, args ...string) (stdout io.ReadCloser, stderr io.ReadCloser, err error)
// Container lifecycle
ContainerRun(ctx context.Context, args []string, interactive bool) error
ContainerList(ctx context.Context, all bool) ([]ContainerInfo, error)
ContainerStop(ctx context.Context, nameOrID string) error
ContainerStart(ctx context.Context, nameOrID string) error
ContainerRemove(ctx context.Context, nameOrID string, force bool) error
ContainerExec(ctx context.Context, nameOrID string, args []string, interactive bool) error
ContainerLogs(ctx context.Context, nameOrID string, opts LogsOptions) error
ContainerInspect(ctx context.Context, nameOrID string) ([]byte, error)
// Images
ImagePull(ctx context.Context, image string, opts ImagePullOpts) error
ImagePush(ctx context.Context, image string) error
ImageList(ctx context.Context) ([]ImageInfo, error)
ImageRemove(ctx context.Context, image string) error
ImageBuild(ctx context.Context, args []string) error
// Networks. Labels may be nil. Compose v2 sends
// com.docker.compose.{project,network,version}; without these, it
// refuses to re-adopt the network on a subsequent 'docker compose up'.
NetworkCreate(ctx context.Context, name string, labels map[string]string) error
NetworkList(ctx context.Context) ([]NetworkInfo, error)
NetworkRemove(ctx context.Context, name string) error
NetworkConnect(ctx context.Context, network, container string) error
NetworkDisconnect(ctx context.Context, network, container string) error
NetworkInspect(ctx context.Context, name string) ([]byte, error)
// Volumes
VolumeCreate(ctx context.Context, name string) error
VolumeList(ctx context.Context) ([]VolumeInfo, error)
VolumeRemove(ctx context.Context, name string) error
VolumeInspect(ctx context.Context, name string) ([]byte, error)
}
Runtime is the interface that all container backends must implement. The current Engine struct (Apple Container CLI) implements this interface. Future backends (e.g., NerdctlRuntime) will also implement it.
func DetectRuntime ¶ added in v0.4.0
DetectRuntime auto-detects the appropriate container runtime for the current platform. On macOS it uses Apple's container CLI, on Linux it uses nerdctl (containerd).
type VolumeInfo ¶
type VolumeInfo struct {
Name string
Driver string
Mountpoint string
Created time.Time
// Labels — see NetworkInfo.Labels. Compose checks
// com.docker.compose.project here too.
Labels map[string]string
}
func ParseNerdctlVolumeList ¶ added in v0.4.0
func ParseNerdctlVolumeList(data []byte) ([]VolumeInfo, error)