docker

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSocketPath = errors.New("invalid docker socket")

ErrSocketPath is the sentinel wrapped by every unix:// socket-path validation failure; IsSocketError detects it to show a dedicated dialog.

Functions

func BackupFilePrefix

func BackupFilePrefix(project string) string

BackupFilePrefix returns the sanitized name prefix shared by all of a project's backup archives — everything before the "-<timestamp>.tar.gz". The UI uses it to find a project's existing backups in the catalog.

func IsConnectionError

func IsConnectionError(err error) bool

IsConnectionError reports whether err looks like a lost/unreachable daemon connection (TCP socket down or SSH tunnel broken), as opposed to a normal operational error like "no such container". The auto-reconnect logic uses it to decide when to start retrying.

func IsHostKeyError

func IsHostKeyError(err error) bool

IsHostKeyError reports whether err is the SSH known_hosts verification failure raised when the remote host key is missing from ~/.ssh/known_hosts or (more commonly) when the host's key has changed since it was recorded — the typical case after a host is re-provisioned. The UI uses it to show a dedicated dialog instead of dumping the raw "knownhosts: key" string into the footer.

func IsHostNotFoundError

func IsHostNotFoundError(err error) bool

IsHostNotFoundError reports whether err is a DNS resolution failure raised when the target host name cannot be resolved — the typical case when the host address is mistyped or the host simply does not exist. Go's net package renders this as "...: no such host". The UI uses it to show a dedicated dialog (the same modal as the host-key notice) instead of dumping the raw "lookup ...: no such host" string into the footer.

func IsSocketError

func IsSocketError(err error) bool

IsSocketError reports whether err is a unix:// socket-path validation failure (missing file, a directory, not a socket, or an empty path). The UI uses it to show a dedicated dialog instead of dumping the raw error into the footer.

func KnownHostsPath

func KnownHostsPath() string

KnownHostsPath returns the OS-specific path to the user's SSH known_hosts file (e.g. C:\Users\you\.ssh\known_hosts on Windows). The file may or may not exist; the path is exposed so the UI can tell the user which file to clean when the host key changed.

func RegistryFromRef

func RegistryFromRef(ref string) string

RegistryFromRef extracts the registry host from an image reference, or "" when the reference targets Docker Hub (no explicit registry). The first path segment is a registry only when it looks like a host (contains "." or ":", or is "localhost").

func SSHClient

func SSHClient(host, keyFile, password string) (*ssh.Client, error)

SSHClient opens a raw SSH client (used by the setup utility).

Types

type Backend

type Backend interface {
	// Containers
	ListContainers(showAll bool) ([]Container, error)
	InspectContainer(id string) (*InspectResult, error)
	StartContainer(id string) error
	StopContainer(id string) error
	RestartContainer(id string) error
	RemoveContainer(id string, force bool) error
	KillContainer(id string, signal string) error
	// ContainerLogs streams log lines until stop is called or the container
	// stops producing. The caller MUST call stop when it abandons the channel,
	// otherwise the Follow connection and producer goroutine leak.
	ContainerLogs(id string, opts LogOptions) (lines <-chan string, stop func(), err error)
	ContainerStats(ids []string) (map[string]ContainerStats, error)
	ExecInteractive(containerID string, cmd []string) (ExecSession, error)
	RunContainer(opts RunOptions) error
	// RunInteractive starts a disposable interactive container from an image
	// (`docker run --rm -it` analogue); closing the session removes it.
	RunInteractive(opts ExecRunOptions) (ExecSession, error)
	// Container filesystem (`docker cp` / browse). ListPath lists a directory
	// inside the container; CopyFromContainer downloads a path into a local
	// directory; CopyToContainer uploads a local path into a container directory.
	ListPath(containerID, dir string) ([]FileEntry, error)
	CopyFromContainer(containerID, srcPath, destDir string) error
	CopyToContainer(containerID, localPath, destDir string) error
	// Images
	ListImages() ([]Image, error)
	InspectImage(id string) (*InspectResult, error)
	RemoveImage(id string, force bool) error
	// Networks
	ListNetworks() ([]Network, error)
	InspectNetwork(id string) (*InspectResult, error)
	RemoveNetwork(id string) error
	CreateNetwork(opts NetworkCreateOptions) error
	// Volumes
	ListVolumes() ([]Volume, error)
	InspectVolume(name string) (*InspectResult, error)
	RemoveVolume(name string) error
	CreateVolume(opts VolumeCreateOptions) error
	PruneVolumes() (int, error)
	// Extra image ops
	PullImage(ref string) error
	PruneImages() (int, error)
	TagImage(source, target string) error
	// PushImage / BuildImage stream daemon progress lines. The returned stop
	// aborts the operation and releases the request/connection; the caller MUST
	// call it when it abandons the channel, otherwise the producer leaks.
	PushImage(ref string, auth RegistryAuth) (lines <-chan string, stop func(), err error)
	BuildImage(contextDir, tag string) (lines <-chan string, stop func(), err error)
	ImageHistory(id string) (*InspectResult, error)
	// Docker Compose projects (discovered via container labels)
	ListComposeProjects() ([]ComposeProject, error)
	ListComposeContainers(project string) ([]Container, error)
	InspectComposeProject(project string) (*InspectResult, error)
	// ComposeLogs streams the aggregated project logs; same stop contract as
	// ContainerLogs.
	ComposeLogs(project string, opts LogOptions) (lines <-chan string, stop func(), err error)
	ComposeStart(project string) error
	ComposeStop(project string) error
	ComposeRestart(project string) error
	ComposePause(project string) error
	ComposeUnpause(project string) error
	ComposeRemove(project string) error
	// ComposeUp/Pull/Down, CreateComposeFile and RestoreComposeProject stream
	// progress lines from the compose engine. Each returns a stop the caller MUST
	// call when it abandons the channel, otherwise the SSH session/producer leak.
	ComposeUp(project string) (lines <-chan string, stop func(), err error)
	ComposePull(project string) (lines <-chan string, stop func(), err error)
	ComposeDown(project string) (lines <-chan string, stop func(), err error)
	ComposeConfig(project string) (string, error)
	ReadComposeFile(project string) (path, content string, err error)
	WriteComposeFile(project, content string) error
	CreateComposeFile(dir, content string) (lines <-chan string, stop func(), err error)
	BackupComposeProject(project string) (string, error)
	RestoreComposeProject(project, backupPath string) (lines <-chan string, stop func(), err error)
	// SupportsHostCompose reports whether the backend can run the compose
	// operations that need shell/filesystem access to the host —
	// up/down/pull/config/edit/create/backup/restore. These require an SSH
	// connection; a tcp:// connection returns false. Discovery and the
	// container-level lifecycle ops (start/stop/restart/…) work regardless.
	SupportsHostCompose() bool
	// System-wide operations
	// SystemDF reports the daemon's disk usage (`docker system df`).
	SystemDF() (*InspectResult, error)
	// SystemPrune removes stopped containers, unused networks, dangling images
	// and the build cache; it returns a human-readable summary.
	SystemPrune() (string, error)
	// Events returns a live stream of Docker daemon events as formatted strings.
	// stop ends the subscription and closes the channel; the caller MUST call it
	// when it abandons the stream (closing the view, refreshing).
	Events() (lines <-chan string, stop func(), err error)
	// Ping checks the connection to the daemon is alive (used by auto-reconnect).
	Ping() error
	// Runtime reports which container engine backs the connection (Docker vs
	// Podman), so the UI can label it and host-side compose ops pick the right
	// CLI verb. The result is probed once and cached.
	Runtime() Runtime
	// Info returns a one-shot daemon summary (container/image counts, version) —
	// the data behind the multi-host dashboard. Reachable is left to the caller.
	Info() (HostSummary, error)
	Close()
}

Backend abstracts all Docker operations for easy mocking and future Podman support.

func New

func New(cfg *config.Config) (Backend, error)

New creates a Backend from the provided config. Supports tcp://, unix:// and ssh:// schemes in cfg.Host.

func NewDisconnected

func NewDisconnected(reason error) Backend

NewDisconnected returns a Backend whose every operation reports that no connection is available, wrapping reason when provided.

type ComposeProject

type ComposeProject struct {
	Project     string // com.docker.compose.project (e.g. "mcmc"); used for `-p`
	Name        string // display name of the deployment (working_dir basename)
	WorkingDir  string // identity: distinguishes deployments sharing a project
	ConfigFiles string
	Status      string // running | stopped | paused | partial | error
	Command     string
	Running     int
	Total       int
}

ComposeProject is a single Docker Compose deployment aggregated from container labels. A "deployment" is identified by its working_dir, not just its project name: several independent compose files (each in its own directory) can share one project name, and they must NOT be lumped together — see WorkingDir.

func (ComposeProject) Identity

func (p ComposeProject) Identity() string

Identity returns the stable key distinguishing this deployment from others: the working_dir when present, else the project name. Backends that don't stamp the working_dir label (nerdctl) fall back to the project name, so the identity is never empty for a discovered deployment.

type Container

type Container struct {
	ID      string
	Name    string
	Image   string
	Status  string
	State   string
	Health  string // healthy | unhealthy | starting | "" (no healthcheck)
	Ports   string
	CPU     string
	Memory  string
	Created time.Time
	// Labels and Networks back the label:/network: filter predicates; they are
	// not shown in the table. Networks holds the attached network names.
	Labels   map[string]string
	Networks []string
}

type ContainerStats

type ContainerStats struct {
	ID         string
	CPUPerc    float64 // CPU usage as a percentage of total host capacity (matches `docker stats`)
	MemUsage   uint64  // memory usage in bytes, page cache excluded
	MemLimit   uint64  // memory limit in bytes
	MemPerc    float64 // MemUsage / MemLimit * 100
	NetRx      uint64  // total bytes received across all networks
	NetTx      uint64  // total bytes sent across all networks
	BlockRead  uint64  // total bytes read from block devices
	BlockWrite uint64  // total bytes written to block devices
}

ContainerStats is a point-in-time resource sample for one container, derived from the Docker Stats API and reduced to the figures the UI displays.

func (ContainerStats) BlockString

func (s ContainerStats) BlockString() string

BlockString formats block I/O as "read / write", e.g. "8.0 MB / 2.0 MB".

func (ContainerStats) CPUString

func (s ContainerStats) CPUString() string

CPUString formats CPU usage like "12.3%".

func (ContainerStats) MemPercString

func (s ContainerStats) MemPercString() string

MemPercString formats memory utilisation like "9.4%".

func (ContainerStats) MemString

func (s ContainerStats) MemString() string

MemString formats memory usage like "45.2 MB".

func (ContainerStats) NetString

func (s ContainerStats) NetString() string

NetString formats network I/O as "rx / tx", e.g. "1.0 MB / 512.0 KB".

type ExecRunOptions

type ExecRunOptions struct {
	Image   string
	Volumes []string
	Cmd     []string
}

ExecRunOptions describes a one-off interactive container run from an image — the `docker run --rm -it` analogue driven by the exec wizard. Volumes take bind specs ("/host:/ctr[:ro]", "vol:/data"); an empty Cmd opens a shell.

type ExecSession

type ExecSession interface {
	io.ReadWriteCloser
	// Resize sets the remote TTY window size (rows × cols, in cells).
	Resize(rows, cols int) error
}

ExecSession is a live interactive exec session bridged to an in-app terminal. Read pulls the remote TTY output, Write pushes user input, Resize updates the remote window size and Close ends the session. With a TTY the daemon merges stdout/stderr into the single stream carried by the hijacked connection. The same path works over TCP and SSH because the SDK client carries the (possibly SSH-tunnelled) transport used for the hijack.

type FakeBackend

type FakeBackend struct {
	Containers []Container
	Images     []Image
	Networks   []Network
	Volumes    []Volume
	Composes   []ComposeProject

	// ComposeFiles maps project name -> compose file content (for edit demo).
	ComposeFiles map[string]string

	// NoHostCompose simulates a tcp:// connection, where host-side compose
	// operations (up/down/pull/config/edit/create/backup/restore) are
	// unavailable. The default (false) mirrors an ssh:// connection so the demo
	// exercises every feature.
	NoHostCompose bool

	// LogLines is the canned log stream returned by ContainerLogs.
	LogLines []string

	// RuntimeKind simulates the container engine reported by Runtime(); the zero
	// value (RuntimeUnknown) is treated as Docker. Set RuntimePodman to exercise
	// the Podman-specific paths without a live host.
	RuntimeKind Runtime
}

FakeBackend is an in-memory Backend implementation used for the --demo mode and for headless UI tests. It serves sample data and reproduces the same daemon-style errors (and their friendly translations) that the real backend returns, so the UI can be exercised without a live Docker host.

func NewFakeBackend

func NewFakeBackend() *FakeBackend

NewFakeBackend returns a FakeBackend pre-populated with representative data.

func (*FakeBackend) BackupComposeProject

func (f *FakeBackend) BackupComposeProject(project string) (string, error)

func (*FakeBackend) BuildImage

func (f *FakeBackend) BuildImage(contextDir, tag string) (<-chan string, func(), error)

BuildImage appends a freshly "built" image and streams canned build output.

func (*FakeBackend) Close

func (f *FakeBackend) Close()

func (*FakeBackend) ComposeConfig

func (f *FakeBackend) ComposeConfig(project string) (string, error)

func (*FakeBackend) ComposeDown

func (f *FakeBackend) ComposeDown(project string) (<-chan string, func(), error)

func (*FakeBackend) ComposeLogs

func (f *FakeBackend) ComposeLogs(project string, opts LogOptions) (<-chan string, func(), error)

func (*FakeBackend) ComposePause

func (f *FakeBackend) ComposePause(p string) error

func (*FakeBackend) ComposePull

func (f *FakeBackend) ComposePull(project string) (<-chan string, func(), error)

func (*FakeBackend) ComposeRemove

func (f *FakeBackend) ComposeRemove(project string) error

func (*FakeBackend) ComposeRestart

func (f *FakeBackend) ComposeRestart(p string) error

func (*FakeBackend) ComposeStart

func (f *FakeBackend) ComposeStart(p string) error

func (*FakeBackend) ComposeStop

func (f *FakeBackend) ComposeStop(p string) error

func (*FakeBackend) ComposeUnpause

func (f *FakeBackend) ComposeUnpause(p string) error

func (*FakeBackend) ComposeUp

func (f *FakeBackend) ComposeUp(project string) (<-chan string, func(), error)

func (*FakeBackend) ContainerLogs

func (f *FakeBackend) ContainerLogs(id string, opts LogOptions) (<-chan string, func(), error)

func (*FakeBackend) ContainerStats

func (f *FakeBackend) ContainerStats(ids []string) (map[string]ContainerStats, error)

ContainerStats returns canned resource samples for the requested running containers (stopped ones are omitted, like the real daemon).

func (*FakeBackend) CopyFromContainer

func (f *FakeBackend) CopyFromContainer(containerID, srcPath, destDir string) error

CopyFromContainer mimics `docker cp` download by writing a placeholder file named after srcPath's base into destDir, so the saved path actually exists.

func (*FakeBackend) CopyToContainer

func (f *FakeBackend) CopyToContainer(containerID, localPath, destDir string) error

CopyToContainer mimics `docker cp` upload: it only validates the local path exists (nothing is stored), so the success/error paths are observable.

func (*FakeBackend) CreateComposeFile

func (f *FakeBackend) CreateComposeFile(dir, content string) (<-chan string, func(), error)

func (*FakeBackend) CreateNetwork

func (f *FakeBackend) CreateNetwork(opts NetworkCreateOptions) error

CreateNetwork appends a new user-defined network so it shows up in the list, rejecting a duplicate name like the real daemon. A blank driver defaults to "bridge".

func (*FakeBackend) CreateVolume

func (f *FakeBackend) CreateVolume(opts VolumeCreateOptions) error

CreateVolume appends a new named volume, rejecting a duplicate name like the real daemon. A blank driver defaults to "local".

func (*FakeBackend) Events

func (f *FakeBackend) Events() (<-chan string, func(), error)

Events returns a fake event stream that emits a small set of deterministic demo events so the UI can exercise the events view without a daemon. The channel stays open (mimicking a live subscription) until stop closes it.

func (*FakeBackend) ExecInteractive

func (f *FakeBackend) ExecInteractive(containerID string, cmd []string) (ExecSession, error)

func (*FakeBackend) ImageHistory

func (f *FakeBackend) ImageHistory(id string) (*InspectResult, error)

ImageHistory returns a canned layer history for the demo.

func (*FakeBackend) Info

func (f *FakeBackend) Info() (HostSummary, error)

Info returns a daemon summary derived from the in-memory demo data, so the multi-host dashboard can be exercised without a live host.

func (*FakeBackend) InspectComposeProject

func (f *FakeBackend) InspectComposeProject(project string) (*InspectResult, error)

func (*FakeBackend) InspectContainer

func (f *FakeBackend) InspectContainer(id string) (*InspectResult, error)

func (*FakeBackend) InspectImage

func (f *FakeBackend) InspectImage(id string) (*InspectResult, error)

func (*FakeBackend) InspectNetwork

func (f *FakeBackend) InspectNetwork(id string) (*InspectResult, error)

func (*FakeBackend) InspectVolume

func (f *FakeBackend) InspectVolume(name string) (*InspectResult, error)

func (*FakeBackend) KillContainer

func (f *FakeBackend) KillContainer(id, signal string) error

func (*FakeBackend) ListComposeContainers

func (f *FakeBackend) ListComposeContainers(project string) ([]Container, error)

ListComposeContainers returns the demo containers as the project's containers.

func (*FakeBackend) ListComposeProjects

func (f *FakeBackend) ListComposeProjects() ([]ComposeProject, error)

func (*FakeBackend) ListContainers

func (f *FakeBackend) ListContainers(showAll bool) ([]Container, error)

func (*FakeBackend) ListImages

func (f *FakeBackend) ListImages() ([]Image, error)

func (*FakeBackend) ListNetworks

func (f *FakeBackend) ListNetworks() ([]Network, error)

func (*FakeBackend) ListPath

func (f *FakeBackend) ListPath(containerID, dir string) ([]FileEntry, error)

ListPath serves the canned fakeFS, rejecting an unknown path like a real `ls`.

func (*FakeBackend) ListVolumes

func (f *FakeBackend) ListVolumes() ([]Volume, error)

func (*FakeBackend) Ping

func (f *FakeBackend) Ping() error

Ping always succeeds for the in-memory fake backend.

func (*FakeBackend) PruneImages

func (f *FakeBackend) PruneImages() (int, error)

func (*FakeBackend) PruneVolumes

func (f *FakeBackend) PruneVolumes() (int, error)

func (*FakeBackend) PullImage

func (f *FakeBackend) PullImage(ref string) error

func (*FakeBackend) PushImage

func (f *FakeBackend) PushImage(ref string, auth RegistryAuth) (<-chan string, func(), error)

PushImage streams canned push progress for the demo. It echoes the registry and whether credentials were supplied so the auth path is observable.

func (*FakeBackend) ReadComposeFile

func (f *FakeBackend) ReadComposeFile(project string) (string, string, error)

func (*FakeBackend) RemoveContainer

func (f *FakeBackend) RemoveContainer(id string, force bool) error

func (*FakeBackend) RemoveImage

func (f *FakeBackend) RemoveImage(id string, force bool) error

func (*FakeBackend) RemoveNetwork

func (f *FakeBackend) RemoveNetwork(id string) error

func (*FakeBackend) RemoveVolume

func (f *FakeBackend) RemoveVolume(name string) error

func (*FakeBackend) RestartContainer

func (f *FakeBackend) RestartContainer(id string) error

func (*FakeBackend) RestoreComposeProject

func (f *FakeBackend) RestoreComposeProject(project, backupPath string) (<-chan string, func(), error)

func (*FakeBackend) RunContainer

func (f *FakeBackend) RunContainer(opts RunOptions) error

RunContainer mimics `docker run -d`: the image must exist among the demo images, the name must be free; the new container appears as running.

func (*FakeBackend) RunInteractive

func (f *FakeBackend) RunInteractive(opts ExecRunOptions) (ExecSession, error)

RunInteractive mimics `docker run --rm -it`: the image must exist among the demo images; the session is the same echoing fake terminal as exec.

func (*FakeBackend) Runtime

func (f *FakeBackend) Runtime() Runtime

Runtime reports the engine the fake simulates. It defaults to Docker; set RuntimeKind to RuntimePodman to exercise the Podman code paths in demo/tests.

func (*FakeBackend) StartContainer

func (f *FakeBackend) StartContainer(id string) error

func (*FakeBackend) StopContainer

func (f *FakeBackend) StopContainer(id string) error

func (*FakeBackend) SupportsHostCompose

func (f *FakeBackend) SupportsHostCompose() bool

SupportsHostCompose mirrors the real backend: true unless NoHostCompose is set to simulate a tcp:// connection.

func (*FakeBackend) SystemDF

func (f *FakeBackend) SystemDF() (*InspectResult, error)

SystemDF returns a canned disk-usage report derived from the demo data.

func (*FakeBackend) SystemPrune

func (f *FakeBackend) SystemPrune() (string, error)

SystemPrune mimics a full prune on the demo data: stopped containers and dangling images disappear, and a summary is reported.

func (*FakeBackend) TagImage

func (f *FakeBackend) TagImage(source, target string) error

TagImage records a new tag pointing at the source image, so it shows up as a separate row in the image list (like the real `docker tag`).

func (*FakeBackend) WriteComposeFile

func (f *FakeBackend) WriteComposeFile(project, content string) error

type FileEntry

type FileEntry struct {
	Name  string
	IsDir bool
}

FileEntry is one entry of a container directory listing (a file or a subdirectory). It carries just enough to drive the filesystem browser; the daemon has no readdir API, so listings come from `ls` run inside the container (see ListPath).

type HostSummary

type HostSummary struct {
	Host      string // saved-host URL the snapshot belongs to
	Reachable bool   // daemon answered Info within the budget
	Err       string // failure reason when unreachable

	Containers int    // total containers
	Running    int    // running containers
	Paused     int    // paused containers
	Stopped    int    // stopped containers
	Images     int    // images
	Version    string // daemon server version
	Name       string // daemon hostname
	NCPU       int    // logical CPUs
	MemTotal   int64  // total memory (bytes)
}

HostSummary is a one-shot snapshot of a Docker daemon used by the multi-host dashboard: aggregate object counts plus version/resource facts. Host and Reachable identify which saved host the snapshot belongs to and whether it answered; Err carries the reason when it did not.

func ProbeHostSummary

func ProbeHostSummary(cfg *config.Config, host string, timeout time.Duration) HostSummary

ProbeHostSummary connects to host with the auth settings from cfg, fetches a daemon summary and tears the connection down — the per-host data behind the dashboard. The whole probe is bounded by timeout: a probe that can't finish in time reports the host unreachable (the dial keeps running in the background and its result is discarded when it eventually returns). It never returns an error — failures land in HostSummary.Err with Reachable=false.

type Image

type Image struct {
	ID      string
	Tags    string
	Size    string
	Created time.Time
}

type InspectResult

type InspectResult struct {
	Name    string
	RawYAML string
}

InspectResult is the generic detail-view payload for any Docker resource.

type LogOptions

type LogOptions struct {
	Tail  int
	Since string
	Until string
}

LogOptions controls how logs are fetched. Tail <= 0 means "all"; Since/Until accept Docker's filter syntax (a duration like "1h"/"10m" or an RFC3339 timestamp); empty values disable that bound.

type NamespacedBackend

type NamespacedBackend interface {
	// Namespaces lists the available namespaces.
	Namespaces() ([]string, error)
	// CurrentNamespace reports the active namespace.
	CurrentNamespace() string
	// SetNamespace switches the active namespace for subsequent operations.
	SetNamespace(name string)
}

NamespacedBackend is an optional capability a Backend may implement when its engine partitions objects into namespaces (containerd via nerdctl). The UI type-asserts it to expose the :namespace command, the picker and the header badge; backends without namespaces (docker/podman) simply don't implement it.

type Network

type Network struct {
	ID     string
	Name   string
	Driver string
	Scope  string
	Subnet string
}

type NetworkCreateOptions

type NetworkCreateOptions struct {
	Name    string
	Driver  string
	Subnet  string
	Gateway string
}

NetworkCreateOptions describes a network to create. Driver defaults to "bridge" when empty; Subnet/Gateway are optional and configure a single IPAM pool when Subnet is set.

type RegistryAuth

type RegistryAuth struct {
	Registry string // server address, e.g. "myregistry:5000"; empty = default
	Username string
	Password string
}

RegistryAuth holds optional credentials for pushing to a private registry. A zero value (empty Username) means an anonymous push, which works for local or insecure registries that don't require a login.

type RunOptions

type RunOptions struct {
	Image   string
	Name    string
	Ports   []string
	Env     []string
	Volumes []string
}

RunOptions describes a container to create and start (the `run` wizard). Image is required; everything else is optional. Ports take `docker run -p` specs ("8080:80", "127.0.0.1:9443:443/udp"), Env takes KEY=VALUE pairs and Volumes takes bind specs ("/host:/ctr", "named-vol:/data[:ro]").

type Runtime

type Runtime string

Runtime identifies the container engine behind the Docker-compatible REST API a Backend talks to. Podman ships a Docker-compatible API (`podman system service`), so the same dockerBackend drives both engines; Runtime lets the UI label the connection and lets host-side compose ops pick the right CLI verb (`docker compose` vs `podman compose`).

const (
	// RuntimeUnknown is the zero value: the engine has not been probed yet (or
	// the probe failed). Callers treat it like Docker for command building.
	RuntimeUnknown Runtime = ""
	RuntimeDocker  Runtime = "docker"
	RuntimePodman  Runtime = "podman"
	// RuntimeContainerd backs the nerdctl CLI backend (containerd has no Docker
	// API, so it cannot reuse dockerBackend). See nerdctl.go.
	RuntimeContainerd Runtime = "containerd"
	// RuntimeCRIO and RuntimeCRI back the crictl backend (crio:// / cri://
	// schemes): CRI-O when the runtime identifies itself as such, the generic
	// CRI label for any other CRI implementation. See cri.go.
	RuntimeCRIO Runtime = "cri-o"
	RuntimeCRI  Runtime = "cri"
)

func (Runtime) Label

func (r Runtime) Label() string

Label renders the runtime for display in the header; an unknown engine is shown as "docker" (the default assumption).

type Volume

type Volume struct {
	Name       string
	Driver     string
	Mountpoint string
	Created    string
}

type VolumeCreateOptions

type VolumeCreateOptions struct {
	Name   string
	Driver string
}

VolumeCreateOptions describes a volume to create. Driver defaults to "local" when empty.

Jump to

Keyboard shortcuts

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