Documentation
¶
Overview ¶
Package docker manages connections to one or more Docker engines and exposes a domain-shaped API (containers, networks, stats, logs) for the rest of the app. Connections are created lazily per host and cached.
Index ¶
- Variables
- type BuildMessage
- type BuildOptions
- type ContainerDetail
- type ContainerSummary
- type CreateSpec
- type DiffEntry
- type DiskUsage
- type Event
- type EventMsg
- type ExecSession
- type FileEntry
- type HistoryEntry
- type HostKeyMismatchError
- type HostKeyUnknownError
- type HostPortProbe
- type ImagePruneResult
- type ImageSummary
- type LogLine
- type Manager
- func (m *Manager) BuildImage(ctx context.Context, hostID int64, buildContext io.Reader, opts BuildOptions, ...) error
- func (m *Manager) Client(ctx context.Context, hostID int64) (*client.Client, error)
- func (m *Manager) Close()
- func (m *Manager) CommitContainer(ctx context.Context, hostID int64, id, ref, comment string) (string, error)
- func (m *Manager) ContainerAction(ctx context.Context, hostID int64, id, action string) error
- func (m *Manager) ContainerDiff(ctx context.Context, hostID int64, id string) ([]DiffEntry, error)
- func (m *Manager) ContainerTop(ctx context.Context, hostID int64, id string) (*TopResult, error)
- func (m *Manager) CopyFrom(ctx context.Context, hostID int64, id, path string) (io.ReadCloser, container.PathStat, error)
- func (m *Manager) CopyTo(ctx context.Context, hostID int64, id, destDir string, content io.Reader) error
- func (m *Manager) CreateContainer(ctx context.Context, hostID int64, spec CreateSpec) (string, error)
- func (m *Manager) CreateVolume(ctx context.Context, hostID int64, name, driver string, ...) (*VolumeSummary, error)
- func (m *Manager) DeletePath(ctx context.Context, hostID int64, id, path string) error
- func (m *Manager) Disconnect(hostID int64)
- func (m *Manager) DiskUsage(ctx context.Context, hostID int64) (*DiskUsage, error)
- func (m *Manager) ExecAttach(ctx context.Context, hostID int64, containerID string, cmd []string, ...) (*ExecSession, error)
- func (m *Manager) ExportContainer(ctx context.Context, hostID int64, id string) (io.ReadCloser, error)
- func (m *Manager) ImageHistory(ctx context.Context, hostID int64, ref string) ([]HistoryEntry, error)
- func (m *Manager) ImportImage(ctx context.Context, hostID int64, tarball io.Reader, ref string) (string, error)
- func (m *Manager) InspectContainer(ctx context.Context, hostID int64, id string) (*ContainerDetail, error)
- func (m *Manager) InspectRaw(ctx context.Context, hostID int64, kind, id string) (json.RawMessage, error)
- func (m *Manager) ListContainers(ctx context.Context, hostID int64) ([]ContainerSummary, error)
- func (m *Manager) ListImages(ctx context.Context, hostID int64) ([]ImageSummary, error)
- func (m *Manager) ListNetworks(ctx context.Context, hostID int64) ([]NetworkSummary, error)
- func (m *Manager) ListPath(ctx context.Context, hostID int64, id, path string) ([]FileEntry, error)
- func (m *Manager) ListVolumes(ctx context.Context, hostID int64) ([]VolumeSummary, error)
- func (m *Manager) LoadImage(ctx context.Context, hostID int64, tar io.Reader) (string, error)
- func (m *Manager) ProbeContainerPorts(ctx context.Context, hostID int64, containerID string) ([]PortProbe, error)
- func (m *Manager) ProbeHostKey(ctx context.Context, hostID int64) (keyLine, fingerprint string, err error)
- func (m *Manager) ProbeHostPorts(ctx context.Context, hostID int64) ([]HostPortProbe, error)
- func (m *Manager) PruneImages(ctx context.Context, hostID int64) (*ImagePruneResult, error)
- func (m *Manager) PruneVolumes(ctx context.Context, hostID int64) (*VolumePruneResult, error)
- func (m *Manager) PullImage(ctx context.Context, hostID int64, ref string, onProgress func(PullProgress)) error
- func (m *Manager) PushImage(ctx context.Context, hostID int64, ref string, onProgress func(PullProgress)) error
- func (m *Manager) RegistryLogin(ctx context.Context, hostID int64, a store.RegistryAuth) error
- func (m *Manager) RemoveImage(ctx context.Context, hostID int64, ref string, force bool) ([]string, error)
- func (m *Manager) RemoveNetwork(ctx context.Context, hostID int64, id string) error
- func (m *Manager) RemoveVolume(ctx context.Context, hostID int64, name string, force bool) error
- func (m *Manager) RenameContainer(ctx context.Context, hostID int64, id, newName string) error
- func (m *Manager) ResourceOverview(ctx context.Context, hostID int64) (ResourceOverview, error)
- func (m *Manager) SampleStats(ctx context.Context, hostID int64, id string) (StatsSample, error)
- func (m *Manager) SaveImage(ctx context.Context, hostID int64, refs []string) (io.ReadCloser, error)
- func (m *Manager) StreamEvents(ctx context.Context, hostID int64, onEvent func(EventMsg)) error
- func (m *Manager) StreamLogs(ctx context.Context, hostID int64, id string, follow bool, tail string, ...) error
- func (m *Manager) StreamStats(ctx context.Context, hostID int64, id string, emit func(StatsSample)) error
- func (m *Manager) SystemInfo(ctx context.Context, hostID int64) (*SystemInfo, error)
- func (m *Manager) TagImage(ctx context.Context, hostID int64, source, target string) error
- func (m *Manager) Topology(ctx context.Context, hostID int64) (*Topology, error)
- func (m *Manager) UpdateContainer(ctx context.Context, hostID int64, id string, memory, nanoCPUs int64, ...) error
- func (m *Manager) WatchEvents(ctx context.Context, hostID int64, fn func(Event)) error
- type MountInfo
- type NetworkAttach
- type NetworkSummary
- type PortMapping
- type PortProbe
- type PortSpec
- type PullProgress
- type ResourceOverview
- type ResourceUsage
- type StatsSample
- type SystemInfo
- type TopResult
- type TopoContainer
- type TopoLink
- type TopoNetwork
- type Topology
- type UsageCategory
- type VolumePruneResult
- type VolumeSummary
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownAction = errors.New("docker: unknown container action")
ErrUnknownAction is returned by ContainerAction for unsupported actions.
Functions ¶
This section is empty.
Types ¶
type BuildMessage ¶
type BuildMessage struct {
Stream string `json:"stream,omitempty"`
Error string `json:"error,omitempty"`
}
BuildMessage is one line of build output forwarded to the UI. Build streams are mostly free-text (Stream); Error carries a build failure.
type BuildOptions ¶
type BuildOptions struct {
Tags []string
Dockerfile string
NoCache bool
BuildArgs map[string]string
}
BuildOptions are the user-facing knobs for an image build.
type ContainerDetail ¶
type ContainerDetail struct {
ID string `json:"id"`
Name string `json:"name"`
Image string `json:"image"`
State string `json:"state"`
Status string `json:"status"`
Health string `json:"health,omitempty"`
Created string `json:"created"`
StartedAt string `json:"startedAt,omitempty"`
RestartCount int `json:"restartCount"`
Command []string `json:"command"`
Env []string `json:"env"`
Labels map[string]string `json:"labels"`
Mounts []MountInfo `json:"mounts"`
Ports []PortMapping `json:"ports"`
Networks []NetworkAttach `json:"networks"`
RestartPolicy string `json:"restartPolicy,omitempty"`
}
ContainerDetail is the full inspect view shown on the detail page.
type ContainerSummary ¶
type ContainerSummary struct {
ID string `json:"id"`
Name string `json:"name"`
Image string `json:"image"`
State string `json:"state"` // running, exited, paused, ...
Status string `json:"status"` // human text, e.g. "Up 3 hours"
Created int64 `json:"created"`
Ports []PortMapping `json:"ports"`
Networks []string `json:"networks"`
Labels map[string]string `json:"labels"`
}
ContainerSummary is a compact view used in lists.
type CreateSpec ¶
type CreateSpec struct {
Image string `json:"image"`
Name string `json:"name"`
Cmd []string `json:"cmd"`
Env []string `json:"env"` // KEY=VALUE
Binds []string `json:"binds"` // src:dst[:ro]
Ports []PortSpec `json:"ports"`
RestartPolicy string `json:"restartPolicy"` // "", no, always, unless-stopped, on-failure
Memory int64 `json:"memory"` // bytes, 0 = unset
NanoCPUs int64 `json:"nanoCpus"` // 0 = unset (cpus * 1e9)
Start bool `json:"start"`
}
CreateSpec is the user-facing container create/run request.
type DiffEntry ¶
type DiffEntry struct {
Kind string `json:"kind"` // modified | added | deleted
Path string `json:"path"`
}
DiffEntry is one filesystem change in a container relative to its image.
type DiskUsage ¶
type DiskUsage struct {
LayersSize int64 `json:"layersSize"`
Images UsageCategory `json:"images"`
Containers UsageCategory `json:"containers"`
Volumes UsageCategory `json:"volumes"`
BuildCache UsageCategory `json:"buildCache"`
}
DiskUsage summarises what Docker is storing (docker system df).
type Event ¶
type Event struct {
Action string // "die", "start", "stop", "kill", "oom", "health_status: unhealthy", ...
ContainerID string
ContainerName string
Image string
ExitCode string
}
Event is a simplified container lifecycle event for the monitor/alert engine.
type EventMsg ¶
type EventMsg struct {
Time int64 `json:"time"`
Type string `json:"type"` // container | image | network | volume | …
Action string `json:"action"` // start | die | pull | create | …
ID string `json:"id"`
Name string `json:"name"`
Attr map[string]string `json:"attr,omitempty"`
}
EventMsg is one Docker daemon event, flattened for the UI.
type ExecSession ¶
type ExecSession struct {
// contains filtered or unexported fields
}
ExecSession is a live interactive exec attached to a container. It is a bidirectional byte stream (Read = container output, Write = stdin) plus a Resize control. Works for any host kind, since it goes through the Docker API.
func (*ExecSession) Conn ¶
func (s *ExecSession) Conn() net.Conn
Conn exposes the underlying connection (for setting deadlines if needed).
func (*ExecSession) Read ¶
func (s *ExecSession) Read(p []byte) (int, error)
Read returns container output (stdout+stderr merged, since TTY).
type FileEntry ¶
type FileEntry struct {
Name string `json:"name"`
IsDir bool `json:"isDir"`
IsLink bool `json:"isLink"`
Size int64 `json:"size"`
Mode string `json:"mode"`
Target string `json:"target,omitempty"` // symlink target
}
FileEntry is one item in a container directory listing.
type HistoryEntry ¶
type HistoryEntry struct {
ID string `json:"id"`
Created int64 `json:"created"`
CreatedBy string `json:"createdBy"`
Size int64 `json:"size"`
Comment string `json:"comment"`
Tags []string `json:"tags"`
}
HistoryEntry is one layer in an image's build history.
type HostKeyMismatchError ¶
type HostKeyMismatchError struct {
Fingerprint string // SHA256:… of the key actually presented now
}
HostKeyMismatchError is returned when the presented key differs from the one we already trust. This is a hard stop: it can mean a reinstalled host — or a man-in-the-middle. We never auto-accept; the operator must re-trust manually.
func (*HostKeyMismatchError) Error ¶
func (e *HostKeyMismatchError) Error() string
type HostKeyUnknownError ¶
type HostKeyUnknownError struct {
Fingerprint string // SHA256:… of the presented key
KeyType string // e.g. "ssh-ed25519"
}
HostKeyUnknownError is returned on first contact with an SSH host whose key is neither pinned in the DB nor present in ~/.ssh/known_hosts. The caller can surface the fingerprint to the operator and, on explicit approval, pin it.
func (*HostKeyUnknownError) Error ¶
func (e *HostKeyUnknownError) Error() string
type HostPortProbe ¶ added in v1.1.0
type HostPortProbe struct {
ContainerID string `json:"containerId"`
ContainerName string `json:"containerName"`
PortProbe
}
HostPortProbe is one published port on the host, tagged with the container that owns it — the rows behind the host-wide "open ports" view.
type ImagePruneResult ¶
type ImagePruneResult struct {
Deleted []string `json:"deleted"`
SpaceReclaimed uint64 `json:"spaceReclaimed"`
}
ImagePruneResult reports what a dangling-image prune removed.
type ImageSummary ¶
type ImageSummary struct {
ID string `json:"id"`
RepoTags []string `json:"repoTags"`
RepoDigests []string `json:"repoDigests"`
Size int64 `json:"size"`
Created int64 `json:"created"` // unix seconds
Dangling bool `json:"dangling"`
InUse bool `json:"inUse"` // referenced by an existing container
}
ImageSummary is a compact view of a local image for the Images page.
type LogLine ¶
type LogLine struct {
Stream string `json:"stream"` // "stdout" | "stderr"
Message string `json:"message"`
Timestamp string `json:"timestamp,omitempty"`
}
LogLine is one line emitted from a container log stream.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns Docker client connections keyed by host ID.
func NewManager ¶
NewManager returns a manager that resolves hosts from the store.
func (*Manager) BuildImage ¶
func (m *Manager) BuildImage(ctx context.Context, hostID int64, buildContext io.Reader, opts BuildOptions, onMsg func(BuildMessage)) error
BuildImage builds an image from a tar (optionally gzip'd) build context, streaming the daemon's output line by line. The context reader is supplied by the caller (typically the uploaded request body).
func (*Manager) Client ¶
Client returns a connected Docker client for the given host ID, creating and caching it on first use. A hostID <= 0 means "the default local host", which lets clients (REST and WebSocket) omit the host when targeting localhost.
func (*Manager) CommitContainer ¶
func (m *Manager) CommitContainer(ctx context.Context, hostID int64, id, ref, comment string) (string, error)
CommitContainer snapshots a container into a new image (reference repo:tag).
func (*Manager) ContainerAction ¶
ContainerAction performs a lifecycle action: start, stop, restart, pause, unpause, kill. Unknown actions return an error.
func (*Manager) ContainerDiff ¶
ContainerDiff lists filesystem changes since the container started.
func (*Manager) ContainerTop ¶
ContainerTop returns the processes running inside a container.
func (*Manager) CopyFrom ¶
func (m *Manager) CopyFrom(ctx context.Context, hostID int64, id, path string) (io.ReadCloser, container.PathStat, error)
CopyFrom streams a path out of a container as a TAR archive along with its stat (so the caller can tell a file from a directory). Caller closes the reader.
func (*Manager) CopyTo ¶
func (m *Manager) CopyTo(ctx context.Context, hostID int64, id, destDir string, content io.Reader) error
CopyTo writes a TAR archive into the container at destDir.
func (*Manager) CreateContainer ¶
func (m *Manager) CreateContainer(ctx context.Context, hostID int64, spec CreateSpec) (string, error)
CreateContainer creates (and optionally starts) a container from a spec.
func (*Manager) CreateVolume ¶
func (m *Manager) CreateVolume(ctx context.Context, hostID int64, name, driver string, labels map[string]string) (*VolumeSummary, error)
CreateVolume creates a named volume with an optional driver.
func (*Manager) DeletePath ¶
DeletePath removes a path inside the container (rm -rf).
func (*Manager) Disconnect ¶
Disconnect drops the cached client for a host (e.g. after it is deleted or reconfigured), so the next use reconnects with fresh settings.
func (*Manager) DiskUsage ¶
DiskUsage reports how much disk Docker objects occupy (docker system df).
func (*Manager) ExecAttach ¶
func (m *Manager) ExecAttach(ctx context.Context, hostID int64, containerID string, cmd []string, cols, rows uint) (*ExecSession, error)
ExecAttach starts a TTY exec in the container and attaches to it. Pass cmd to override the shell. cols/rows seed the initial terminal size.
func (*Manager) ExportContainer ¶
func (m *Manager) ExportContainer(ctx context.Context, hostID int64, id string) (io.ReadCloser, error)
ExportContainer streams a container's filesystem as a tar archive.
func (*Manager) ImageHistory ¶
func (m *Manager) ImageHistory(ctx context.Context, hostID int64, ref string) ([]HistoryEntry, error)
ImageHistory returns the layer history of an image.
func (*Manager) ImportImage ¶
func (m *Manager) ImportImage(ctx context.Context, hostID int64, tarball io.Reader, ref string) (string, error)
ImportImage creates an image from a filesystem tarball (docker import), tagging it as ref. It returns the daemon's output summary.
func (*Manager) InspectContainer ¶
func (m *Manager) InspectContainer(ctx context.Context, hostID int64, id string) (*ContainerDetail, error)
InspectContainer returns the detailed view of a single container.
func (*Manager) InspectRaw ¶
func (m *Manager) InspectRaw(ctx context.Context, hostID int64, kind, id string) (json.RawMessage, error)
InspectRaw returns the daemon's raw JSON for an object, preserving every field (more faithful than re-marshalling the SDK struct). kind is one of container, image, network, volume.
func (*Manager) ListContainers ¶
ListContainers returns a compact summary of all containers on the host.
func (*Manager) ListImages ¶
ListImages returns local images, flagging which are untagged ("dangling") and which are referenced by an existing container (so the UI can warn before removing one that is in use).
func (*Manager) ListNetworks ¶
ListNetworks returns networks plus the set of containers attached to each, which the frontend uses to draw the connectivity topology.
func (*Manager) ListPath ¶
ListPath lists one directory level inside a container by running `ls`. It is shell-independent (direct argv) but needs an `ls` binary in the image.
func (*Manager) ListVolumes ¶
ListVolumes returns all volumes, cross-referencing containers' mounts so the UI can show (and warn about) volumes that are still in use.
func (*Manager) LoadImage ¶
LoadImage loads images from a tar archive (docker save format) and returns the daemon's human-readable summary (e.g. "Loaded image: repo:tag").
func (*Manager) ProbeContainerPorts ¶ added in v1.1.0
func (m *Manager) ProbeContainerPorts(ctx context.Context, hostID int64, containerID string) ([]PortProbe, error)
ProbeContainerPorts actively fingerprints every published TCP port of a container: it connects (locally, or tunnelled through SSH for ssh hosts) and classifies the listener by banner / HTTP / TLS / Redis handshake. UDP and unpublished ports get a passive guess only.
func (*Manager) ProbeHostKey ¶
func (m *Manager) ProbeHostKey(ctx context.Context, hostID int64) (keyLine, fingerprint string, err error)
ProbeHostKey connects to an SSH host and returns its presented public key (authorized_keys line) and SHA256 fingerprint, trusting whatever is offered. It is used only by the explicit trust flow, so the operator can pin a key after reviewing its fingerprint.
func (*Manager) ProbeHostPorts ¶ added in v1.1.0
ProbeHostPorts scans every published port of every running container on the host — the host-wide "open ports" map. Probes run in one bounded pool so a busy host doesn't open a flood of connections at once.
func (*Manager) PruneImages ¶
PruneImages removes dangling images and reports what was reclaimed.
func (*Manager) PruneVolumes ¶
PruneVolumes removes all unused (anonymous and named) volumes.
func (*Manager) PullImage ¶
func (m *Manager) PullImage(ctx context.Context, hostID int64, ref string, onProgress func(PullProgress)) error
PullImage pulls a reference and reports progress via onProgress until the stream completes. The Docker daemon emits newline-delimited JSON messages; we decode them and translate to PullProgress. A message carrying an error aborts the pull with that error.
func (*Manager) PushImage ¶
func (m *Manager) PushImage(ctx context.Context, hostID int64, ref string, onProgress func(PullProgress)) error
PushImage pushes a reference to its registry, streaming progress like a pull. Pushing requires credentials for the target registry; without them we fail early with a clear message rather than letting the daemon return a raw 401.
func (*Manager) RegistryLogin ¶
RegistryLogin verifies a set of credentials against a registry via the daemon.
func (*Manager) RemoveImage ¶
func (m *Manager) RemoveImage(ctx context.Context, hostID int64, ref string, force bool) ([]string, error)
RemoveImage deletes an image by ID or reference. force allows removing an image that is tagged multiple times or referenced by stopped containers. It returns the list of untagged/deleted references for the UI.
func (*Manager) RemoveNetwork ¶
RemoveNetwork deletes a user-defined network. The daemon refuses to remove predefined networks (bridge/host/none) or ones with attached endpoints, and that error is surfaced to the caller.
func (*Manager) RemoveVolume ¶
RemoveVolume deletes a volume. force removes it even if the metadata claims a reference; the daemon still refuses volumes actively mounted by a container.
func (*Manager) RenameContainer ¶
RenameContainer changes a container's name.
func (*Manager) ResourceOverview ¶ added in v1.1.0
ResourceOverview samples every running container and reports each one's share of the host's total CPU and memory. Per-container stats are gathered concurrently (bounded); a container that fails to sample is simply omitted.
func (*Manager) SampleStats ¶
SampleStats fetches a single (non-streaming) stats frame and computes one sample. Used by the monitor for periodic polling and the Prometheus exporter.
func (*Manager) SaveImage ¶
func (m *Manager) SaveImage(ctx context.Context, hostID int64, refs []string) (io.ReadCloser, error)
SaveImage streams one or more images as a tar archive (docker save format). The caller is responsible for closing the returned reader.
func (*Manager) StreamEvents ¶
StreamEvents forwards live daemon events to onEvent until the context is cancelled or the daemon stream errors. It mirrors the pull/exec streaming pattern so the handler can bridge it straight to a WebSocket.
func (*Manager) StreamLogs ¶
func (m *Manager) StreamLogs(ctx context.Context, hostID int64, id string, follow bool, tail string, emit func(LogLine)) error
StreamLogs tails a container's logs, invoking emit per line. When follow is true it streams until ctx is cancelled; tail bounds the initial backlog.
func (*Manager) StreamStats ¶
func (m *Manager) StreamStats(ctx context.Context, hostID int64, id string, emit func(StatsSample)) error
StreamStats subscribes to a container's stats stream and invokes emit for each computed sample until ctx is cancelled or the stream ends.
func (*Manager) SystemInfo ¶
SystemInfo returns a summary of the Docker host.
func (*Manager) TagImage ¶
TagImage adds a new tag (target) to an existing image (source). It is the prerequisite for pushing a local image under a registry-qualified name.
func (*Manager) UpdateContainer ¶
func (m *Manager) UpdateContainer(ctx context.Context, hostID int64, id string, memory, nanoCPUs int64, restartPolicy string) error
UpdateContainer adjusts a running container's resource limits and restart policy at runtime. Zero values leave the corresponding limit unchanged-as-set.
type MountInfo ¶
type MountInfo struct {
Type string `json:"type"`
Source string `json:"source"`
Destination string `json:"destination"`
RW bool `json:"rw"`
}
MountInfo describes a volume or bind mount.
type NetworkAttach ¶
type NetworkAttach struct {
Name string `json:"name"`
NetworkID string `json:"networkId"`
IPAddress string `json:"ipAddress"`
Gateway string `json:"gateway"`
MacAddress string `json:"macAddress"`
}
NetworkAttach links a container to a network with its assigned address.
type NetworkSummary ¶
type NetworkSummary struct {
ID string `json:"id"`
Name string `json:"name"`
Driver string `json:"driver"`
Scope string `json:"scope"`
Internal bool `json:"internal"`
Subnets []string `json:"subnets"`
Containers []string `json:"containers"` // container IDs attached
}
NetworkSummary describes a Docker network for the networks/topology views.
type PortMapping ¶
type PortMapping struct {
IP string `json:"ip,omitempty"`
PrivatePort uint16 `json:"privatePort"`
PublicPort uint16 `json:"publicPort,omitempty"`
Type string `json:"type"`
}
PortMapping describes one published port.
type PortProbe ¶ added in v1.1.0
type PortProbe struct {
PrivatePort uint16 `json:"privatePort"`
PublicPort uint16 `json:"publicPort"`
Type string `json:"type"` // tcp | udp
GuessByPort string `json:"guessByPort"`
Open bool `json:"open"`
Detected string `json:"detected"` // active fingerprint, "" if inconclusive
Info string `json:"info,omitempty"` // banner / Server header / TLS subject
TLS bool `json:"tls"` // a TLS handshake succeeded
Error string `json:"error,omitempty"` // why the probe failed (closed/timeout)
}
PortProbe is the result of inspecting one published container port: the passive guess (from the well-known port number) plus the active fingerprint of whatever is actually listening.
type PortSpec ¶
type PortSpec struct {
HostPort string `json:"hostPort"` // empty = expose only, no host binding
ContainerPort string `json:"containerPort"` // required
Proto string `json:"proto"` // tcp (default) | udp
}
PortSpec is one published port in a create request.
type PullProgress ¶
type PullProgress struct {
Status string `json:"status,omitempty"`
ID string `json:"id,omitempty"`
Current int64 `json:"current,omitempty"`
Total int64 `json:"total,omitempty"`
Error string `json:"error,omitempty"`
Done bool `json:"done,omitempty"`
}
PullProgress is one progress update from an image pull, forwarded to the UI.
type ResourceOverview ¶ added in v1.1.0
type ResourceOverview struct {
CPUs int `json:"cpus"`
MemTotal int64 `json:"memTotal"`
Containers []ResourceUsage `json:"containers"`
}
ResourceOverview is a snapshot of how the running containers divide up the host's CPU and memory — the data behind the dashboard's usage breakdown.
type ResourceUsage ¶ added in v1.1.0
type ResourceUsage struct {
ID string `json:"id"`
Name string `json:"name"`
CPUPercent float64 `json:"cpuPercent"` // share of total host CPU (0..100)
MemBytes uint64 `json:"memBytes"`
MemPercent float64 `json:"memPercent"` // share of total host memory (0..100)
}
ResourceUsage is one container's live share of the host's CPU and memory.
type StatsSample ¶
type StatsSample struct {
ContainerID string `json:"containerId"`
Timestamp int64 `json:"timestamp"` // unix millis
CPUPercent float64 `json:"cpuPercent"`
MemUsage uint64 `json:"memUsage"`
MemLimit uint64 `json:"memLimit"`
MemPercent float64 `json:"memPercent"`
NetRx uint64 `json:"netRx"`
NetTx uint64 `json:"netTx"`
BlkRead uint64 `json:"blkRead"`
BlkWrite uint64 `json:"blkWrite"`
PIDs uint64 `json:"pids"`
}
StatsSample is one point in a container's real-time resource time series.
type SystemInfo ¶
type SystemInfo struct {
HostName string `json:"hostName"`
ServerVersion string `json:"serverVersion"`
OperatingSystem string `json:"operatingSystem"`
OSType string `json:"osType"`
OSVersion string `json:"osVersion"`
KernelVersion string `json:"kernelVersion"`
Architecture string `json:"architecture"`
CPUs int `json:"cpus"`
MemTotal int64 `json:"memTotal"`
StorageDriver string `json:"storageDriver"`
LoggingDriver string `json:"loggingDriver"`
CgroupDriver string `json:"cgroupDriver"`
CgroupVersion string `json:"cgroupVersion"`
DockerRootDir string `json:"dockerRootDir"`
LiveRestore bool `json:"liveRestore"`
Containers int `json:"containers"`
ContainersRunning int `json:"containersRunning"`
ContainersPaused int `json:"containersPaused"`
ContainersStopped int `json:"containersStopped"`
Images int `json:"images"`
}
SystemInfo summarises the Docker host itself: hardware, OS/kernel and the engine configuration. Note that for Docker Desktop (Windows/macOS) these describe the engine's Linux VM, not the desktop OS — the Docker API does not expose the underlying host, so KernelVersion/OSType are the best hint (e.g. a "…microsoft-standard-WSL2" kernel reveals a Windows/WSL2 host).
type TopoContainer ¶
type TopoContainer struct {
ID string `json:"id"`
Name string `json:"name"`
Image string `json:"image"`
State string `json:"state"`
}
TopoContainer is a container node in the topology graph.
type TopoLink ¶
type TopoLink struct {
ContainerID string `json:"containerId"`
NetworkID string `json:"networkId"`
IPAddress string `json:"ipAddress"`
}
TopoLink is an edge: a container attached to a network with an assigned IP.
type TopoNetwork ¶
type TopoNetwork struct {
ID string `json:"id"`
Name string `json:"name"`
Driver string `json:"driver"`
Scope string `json:"scope"`
Internal bool `json:"internal"`
Subnets []string `json:"subnets"`
}
TopoNetwork is a network node in the topology graph.
type Topology ¶
type Topology struct {
Networks []TopoNetwork `json:"networks"`
Containers []TopoContainer `json:"containers"`
Links []TopoLink `json:"links"`
}
Topology is a graph view of how containers attach to networks, consumed by the frontend connectivity diagram.
type UsageCategory ¶
UsageCategory is a count + total size for one class of Docker object.
type VolumePruneResult ¶
type VolumePruneResult struct {
Deleted []string `json:"deleted"`
SpaceReclaimed uint64 `json:"spaceReclaimed"`
}
VolumePruneResult reports what an unused-volume prune removed.
type VolumeSummary ¶
type VolumeSummary struct {
Name string `json:"name"`
Driver string `json:"driver"`
Mountpoint string `json:"mountpoint"`
Scope string `json:"scope"`
CreatedAt string `json:"createdAt"`
Labels map[string]string `json:"labels"`
InUseBy []string `json:"inUseBy"` // container names mounting this volume
}
VolumeSummary describes a Docker volume for the Volumes page, including which containers currently mount it so removal is informed.