Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package api is the engine's API, compatible with a subset of the Docker Engine API (v1.47): what wctrd serves on a unix socket, and the client wctr speaks it with. Shapes follow the v1.47 OpenAPI document (see docs/REFERENCES.md); only the fields the engine fills are present.

The client side (types, Client, stdcopy) imports neither the daemon nor wazero, so the wctr command builds for wasip1.

Index

Constants

View Source
const (
	StreamStdin  byte = 0
	StreamStdout byte = 1
	StreamStderr byte = 2
)

Stream types of the multiplexed stream.

View Source
const (
	APIVersion    = "1.47"
	MinAPIVersion = "1.24"
)

APIVersion is the version the server speaks; MinAPIVersion the oldest it accepts in a /vX.Y prefix.

View Source
const DefaultSocket = "/var/run/wctr.sock"

DefaultSocket is where wctrd listens and wctr connects when neither -H nor WCTR_HOST says otherwise.

View Source
const HostEnv = "WCTR_HOST"

HostEnv names the environment variable that overrides the daemon host.

Variables

View Source
var ErrBadFrame = errors.New("malformed multiplexed stream")

ErrBadFrame is returned for a malformed multiplexed stream.

View Source
var KnownCaps = []string{"gpu"}

KnownCaps are the device capabilities this engine grants: "gpu" opens the local GPU to a container's host modules (wasi:webgpu, wasi-nn on the GPU).

Functions

func DefaultHost

func DefaultHost() string

DefaultHost is $WCTR_HOST if set, else unix:// + DefaultSocket.

func Demux

func Demux(stdout, stderr io.Writer, r io.Reader) error

Demux copies a multiplexed stream to stdout and stderr (stdin frames, type 0, go to stdout as the format says), until EOF.

func DeviceCaps added in v0.13.0

func DeviceCaps(reqs []DeviceRequest) ([]string, error)

DeviceCaps turns device requests into the capabilities they grant. A request is satisfied by the first of its OR alternatives made only of known capabilities; a request none of whose alternatives is known, or one naming a driver or device IDs (there are no host devices to pick in a WebAssembly engine), is refused.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reports a 404 from the daemon.

func WriteFrame

func WriteFrame(w io.Writer, stream byte, p []byte) error

WriteFrame writes one frame: header [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1..SIZE4 big-endian}, then the payload.

Types

type BlkioEntry added in v0.7.0

type BlkioEntry struct {
	Major uint64 `json:"major"`
	Minor uint64 `json:"minor"`
	Op    string `json:"op"`
	Value uint64 `json:"value"`
}

BlkioEntry is one blkio counter.

type BlkioStats added in v0.7.0

type BlkioStats struct {
	IOServiceBytesRecursive []BlkioEntry `json:"io_service_bytes_recursive"`
}

BlkioStats carries the bytes written to the container's filesystem.

type CPUStats added in v0.7.0

type CPUStats struct {
	CPUUsage struct {
		TotalUsage uint64 `json:"total_usage"`
	} `json:"cpu_usage"`
	SystemCPUUsage uint64 `json:"system_cpu_usage"`
	OnlineCPUs     uint32 `json:"online_cpus"`
}

CPUStats is Docker's CPU block, left at zero here.

type Client

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

Client speaks the API to a daemon.

func NewClient

func NewClient(host string) (*Client, error)

NewClient connects to host: "unix:///path/to/socket".

func NewClientWith

func NewClientWith(hc *http.Client, base string) *Client

NewClientWith uses a caller-provided HTTP client and base URL (tests, and later the browser's own transport).

func (*Client) Attach added in v0.5.0

func (c *Client) Attach(ctx context.Context, id string) (io.ReadCloser, error)

Attach streams a container's output from now until its next exit, multiplexed (see Demux). Attach before Start so nothing is missed.

func (*Client) Changes added in v0.4.0

func (c *Client) Changes(ctx context.Context, id string) ([]FilesystemChange, error)

Changes lists what a container changed in its filesystem.

func (*Client) Commit added in v0.12.0

func (c *Client) Commit(ctx context.Context, o CommitOptions) (string, error)

Commit makes an image of a container's changes; it returns the image ID.

func (*Client) Containers

func (c *Client) Containers(ctx context.Context, all bool, filters ...Filters) ([]ContainerSummary, error)

Containers lists containers, with optional filters (label, name, id, status, network).

func (*Client) CopyFrom added in v0.12.0

func (c *Client) CopyFrom(ctx context.Context, container, p string) (io.ReadCloser, error)

CopyFrom returns a tar of the container's path p (GET /containers/{id}/archive); the caller closes it.

func (*Client) CopyTo added in v0.12.0

func (c *Client) CopyTo(ctx context.Context, container, dir string, tarball io.Reader) error

CopyTo extracts a tar into the container's directory dir (PUT /containers/{id}/archive).

func (*Client) Create

Create creates a container.

func (*Client) DiskUsage added in v0.4.0

func (c *Client) DiskUsage(ctx context.Context) (SystemDataUsage, error)

DiskUsage is GET /system/df.

func (*Client) Events added in v0.6.0

func (c *Client) Events(ctx context.Context, o EventsOptions, fn func(EventMessage) error) error

Events streams events to fn until the stream ends (until reached, the context cancelled, or the daemon cutting off a slow reader).

func (*Client) HTTP added in v0.12.0

func (c *Client) HTTP() (*http.Client, string)

HTTP returns the client's HTTP client and the engine's base URL, API version included ("http://wctr/v1.47"), for a caller that speaks the API itself (a builder streaming a context).

func (*Client) ImageInspect

func (c *Client) ImageInspect(ctx context.Context, ref string) (json.RawMessage, error)

ImageInspect inspects an image.

func (*Client) ImageLoad added in v0.12.0

func (c *Client) ImageLoad(ctx context.Context, layoutTar io.Reader) ([]string, error)

ImageLoad sends an OCI image layout tar (POST /images/load) and returns the "Loaded image…" lines.

func (*Client) ImageTag added in v0.12.0

func (c *Client) ImageTag(ctx context.Context, source, repo, tag string) error

ImageTag names an image repo[:tag].

func (*Client) Images

func (c *Client) Images(ctx context.Context) ([]ImageSummary, error)

Images lists images.

func (*Client) Inspect

func (c *Client) Inspect(ctx context.Context, id string) (json.RawMessage, error)

Inspect inspects a container.

func (*Client) Kill

func (c *Client) Kill(ctx context.Context, id string) error

Kill kills a running container.

func (*Client) Logs

func (c *Client) Logs(ctx context.Context, id string, follow bool) (io.ReadCloser, error)

Logs returns the multiplexed log stream; demultiplex it with Demux.

func (*Client) NetworkConnect added in v0.14.0

func (c *Client) NetworkConnect(ctx context.Context, network, container string, aliases []string) error

NetworkConnect puts a container on a network, answering there to its name and aliases.

func (*Client) NetworkCreate added in v0.10.0

NetworkCreate makes an in-engine network.

func (*Client) NetworkDisconnect added in v0.14.0

func (c *Client) NetworkDisconnect(ctx context.Context, network, container string, force bool) error

NetworkDisconnect takes a container off a network.

func (*Client) NetworkInspect added in v0.10.0

func (c *Client) NetworkInspect(ctx context.Context, ref string) (json.RawMessage, error)

NetworkInspect inspects a network.

func (*Client) NetworkPrune added in v0.14.0

func (c *Client) NetworkPrune(ctx context.Context, labels []string) (NetworkPruneResponse, error)

NetworkPrune removes the networks no container uses (those whose labels match every label filter: "k", "k=v", "k!=v").

func (*Client) NetworkRemove added in v0.10.0

func (c *Client) NetworkRemove(ctx context.Context, ref string) error

NetworkRemove removes a network.

func (*Client) Networks added in v0.10.0

func (c *Client) Networks(ctx context.Context, filters ...Filters) ([]Network, error)

Networks lists networks, with optional filters (label, name, id, driver).

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping checks the daemon answers.

func (*Client) PruneContainers added in v0.4.0

func (c *Client) PruneContainers(ctx context.Context) (ContainerPruneResponse, error)

PruneContainers removes every stopped container.

func (*Client) PruneImages added in v0.4.0

func (c *Client) PruneImages(ctx context.Context, all bool) (ImagePruneResponse, error)

PruneImages removes dangling images, or with all every image no container uses.

func (*Client) Pull

func (c *Client) Pull(ctx context.Context, ref string, progress func(JSONMessage)) error

Pull pulls ref, calling progress for each message; an error message in the stream is returned as an error.

func (*Client) Remove

func (c *Client) Remove(ctx context.Context, id string, force bool) error

Remove removes a container.

func (*Client) RemoveImage

func (c *Client) RemoveImage(ctx context.Context, ref string, force bool) ([]ImageDeleteResponseItem, error)

RemoveImage removes an image.

func (*Client) Restart added in v0.5.0

func (c *Client) Restart(ctx context.Context, id string) error

Restart stops a container if it runs, then starts it.

func (*Client) Start

func (c *Client) Start(ctx context.Context, id string) error

Start starts a container.

func (*Client) StatPath added in v0.14.0

func (c *Client) StatPath(ctx context.Context, container, p string) (ContainerPathStat, error)

StatPath describes the container's path p without copying it (HEAD /containers/{id}/archive).

func (*Client) Stats added in v0.7.0

func (c *Client) Stats(ctx context.Context, id string, stream bool, fn func(ContainerStats) error) error

Stats reads a container's stats once (stream false) or once a second until fn returns an error or the stream ends.

func (*Client) Stop added in v0.5.0

func (c *Client) Stop(ctx context.Context, id string) error

Stop stops a running container and returns once it has exited; a container that is not running is not an error (the daemon answers 304).

func (*Client) Version

func (c *Client) Version(ctx context.Context) (SystemVersion, error)

Version returns the daemon's version.

func (*Client) VolumeCreate added in v0.8.0

func (c *Client) VolumeCreate(ctx context.Context, o VolumeCreateOptions) (Volume, error)

VolumeCreate makes a volume (or returns the existing one).

func (*Client) VolumeInspect added in v0.8.0

func (c *Client) VolumeInspect(ctx context.Context, name string) (json.RawMessage, error)

VolumeInspect inspects a volume.

func (*Client) VolumeRemove added in v0.8.0

func (c *Client) VolumeRemove(ctx context.Context, name string, force bool) error

VolumeRemove removes a volume.

func (*Client) Volumes added in v0.8.0

func (c *Client) Volumes(ctx context.Context, filters ...Filters) ([]Volume, error)

Volumes lists volumes, with optional filters (name, label, dangling).

func (*Client) VolumesPrune added in v0.8.0

func (c *Client) VolumesPrune(ctx context.Context, all bool) (VolumePruneResponse, error)

VolumesPrune removes unused anonymous volumes, or with all every unused one.

func (*Client) Wait

func (c *Client) Wait(ctx context.Context, id, condition string) (*Waiter, error)

Wait registers a wait for condition; it returns once the daemon has acknowledged it, before the container exits.

type CommitOptions added in v0.12.0

type CommitOptions struct {
	Container, Repo, Tag, Comment, Author string
	Changes                               []string
	Config                                *ImageConfig
}

CommitOptions is POST /commit's query; Config, when set, is the body.

type CommitResponse added in v0.12.0

type CommitResponse struct {
	ID string `json:"Id"`
}

CommitResponse is the reply to POST /commit.

type ContainerConfig

type ContainerConfig struct {
	Image      string            `json:"Image"`
	Cmd        StrSlice          `json:"Cmd"`
	Entrypoint StrSlice          `json:"Entrypoint"`
	Env        []string          `json:"Env"`
	WorkingDir string            `json:"WorkingDir"`
	Labels     map[string]string `json:"Labels"`
	Tty        bool              `json:"Tty"`
}

ContainerConfig is the create body's container part.

type ContainerCreateRequest

type ContainerCreateRequest struct {
	ContainerConfig
	HostConfig       HostConfig        `json:"HostConfig"`
	NetworkingConfig *NetworkingConfig `json:"NetworkingConfig,omitempty"`
}

ContainerCreateRequest is the body of POST /containers/create.

type ContainerCreateResponse

type ContainerCreateResponse struct {
	ID       string   `json:"Id"`
	Warnings []string `json:"Warnings"`
}

ContainerCreateResponse is the reply to POST /containers/create.

type ContainerInspect

type ContainerInspect struct {
	ID           string          `json:"Id"`
	Created      string          `json:"Created"`
	Path         string          `json:"Path"`
	Args         []string        `json:"Args"`
	State        ContainerState  `json:"State"`
	Image        string          `json:"Image"`
	Name         string          `json:"Name"`
	RestartCount int             `json:"RestartCount"`
	Driver       string          `json:"Driver"`
	Platform     string          `json:"Platform"`
	SizeRw       int64           `json:"SizeRw"`
	Config       ContainerConfig `json:"Config"`
	HostConfig   HostConfig      `json:"HostConfig"`
	Mounts       []MountPoint    `json:"Mounts"`
	// NetworkSettings has the address while the container runs.
	NetworkSettings NetworkSettings `json:"NetworkSettings"`
}

ContainerInspect is GET /containers/{id}/json (a subset).

type ContainerPathStat added in v0.14.0

type ContainerPathStat struct {
	Name       string `json:"name"`
	Size       int64  `json:"size"`
	Mode       uint32 `json:"mode"`
	Mtime      string `json:"mtime"`
	LinkTarget string `json:"linkTarget"`
}

ContainerPathStat is the base64 JSON of the X-Docker-Container-Path-Stat header (GET and HEAD /containers/{id}/archive).

type ContainerPruneResponse added in v0.4.0

type ContainerPruneResponse struct {
	ContainersDeleted []string `json:"ContainersDeleted"`
	SpaceReclaimed    int64    `json:"SpaceReclaimed"`
}

ContainerPruneResponse is POST /containers/prune.

type ContainerState

type ContainerState struct {
	Status     string `json:"Status"`
	Running    bool   `json:"Running"`
	Paused     bool   `json:"Paused"`
	Restarting bool   `json:"Restarting"`
	OOMKilled  bool   `json:"OOMKilled"`
	Dead       bool   `json:"Dead"`
	Pid        int    `json:"Pid"`
	ExitCode   int    `json:"ExitCode"`
	Error      string `json:"Error"`
	StartedAt  string `json:"StartedAt"`
	FinishedAt string `json:"FinishedAt"`
}

ContainerState is the State of an inspect reply.

type ContainerStats added in v0.7.0

type ContainerStats struct {
	Read        string        `json:"read"`
	Preread     string        `json:"preread"`
	Name        string        `json:"name"`
	ID          string        `json:"id"`
	PidsStats   PidsStats     `json:"pids_stats"`
	MemoryStats MemoryStats   `json:"memory_stats"`
	CPUStats    CPUStats      `json:"cpu_stats"`
	PreCPUStats CPUStats      `json:"precpu_stats"`
	BlkioStats  BlkioStats    `json:"blkio_stats"`
	Wctr        WctrStatsInfo `json:"wctr"`
}

ContainerStats is one reading of GET /containers/{id}/stats, in Docker's shape: memory_stats usage/limit, blkio writes, pids. CPU fields are present and zero: a wasm guest gives the engine no CPU accounting, which Wctr.CPU says rather than leaving it to be read as idle.

type ContainerSummary

type ContainerSummary struct {
	ID         string            `json:"Id"`
	Names      []string          `json:"Names"`
	Image      string            `json:"Image"`
	ImageID    string            `json:"ImageID"`
	Command    string            `json:"Command"`
	Created    int64             `json:"Created"`
	Ports      []any             `json:"Ports"`
	SizeRw     int64             `json:"SizeRw,omitempty"`
	Labels     map[string]string `json:"Labels"`
	State      string            `json:"State"`
	Status     string            `json:"Status"`
	HostConfig struct {
		NetworkMode string `json:"NetworkMode"`
	} `json:"HostConfig"`
}

ContainerSummary is one entry of GET /containers/json.

type ContainerWaitExitError

type ContainerWaitExitError struct {
	Message string `json:"Message"`
}

ContainerWaitExitError is the error part of a wait reply.

type ContainerWaitResponse

type ContainerWaitResponse struct {
	StatusCode int64                   `json:"StatusCode"`
	Error      *ContainerWaitExitError `json:"Error"`
}

ContainerWaitResponse is the reply to POST /containers/{id}/wait.

type DeviceRequest added in v0.13.0

type DeviceRequest struct {
	Driver       string            `json:"Driver,omitempty"`
	Count        int               `json:"Count,omitempty"`
	DeviceIDs    []string          `json:"DeviceIDs,omitempty"`
	Capabilities [][]string        `json:"Capabilities,omitempty"`
	Options      map[string]string `json:"Options,omitempty"`
}

DeviceRequest is Docker's request for devices from a device driver. Capabilities is an OR list of AND lists ([["gpu"]]).

func GPURequest added in v0.13.0

func GPURequest() DeviceRequest

GPURequest is what run --gpu sends: every device with the capability "gpu" (Docker's --gpus all).

type EndpointSettings added in v0.10.0

type EndpointSettings struct {
	Aliases     []string `json:"Aliases"`
	NetworkID   string   `json:"NetworkID,omitempty"`
	IPAddress   string   `json:"IPAddress"`
	IPPrefixLen int      `json:"IPPrefixLen,omitempty"`
	DNSNames    []string `json:"DNSNames"`
}

EndpointSettings is a container's place on one network.

type ErrDaemon

type ErrDaemon struct {
	Status  int
	Message string
}

ErrDaemon is wrapped by every error reply of the daemon.

func (*ErrDaemon) Error

func (e *ErrDaemon) Error() string

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
}

ErrorResponse is the body of every error.

type EventActor added in v0.6.0

type EventActor struct {
	ID         string            `json:"ID"`
	Attributes map[string]string `json:"Attributes"`
}

EventActor is what emitted an event.

type EventMessage added in v0.6.0

type EventMessage struct {
	Type     string     `json:"Type"`
	Action   string     `json:"Action"`
	Actor    EventActor `json:"Actor"`
	Scope    string     `json:"scope"`
	Time     int64      `json:"time"`
	TimeNano int64      `json:"timeNano"`
}

EventMessage is one line of GET /events.

type EventsOptions added in v0.6.0

type EventsOptions struct {
	Since, Until string
	Filters      map[string][]string
}

EventsOptions selects events: since and until as GET /events takes them (Unix seconds, RFC 3339 or a duration back from now), filters as key → values.

type FilesystemChange added in v0.4.0

type FilesystemChange struct {
	Path string `json:"Path"`
	Kind int    `json:"Kind"`
}

FilesystemChange is one entry of GET /containers/{id}/changes; Kind is 0 modified, 1 added, 2 deleted.

type Filters added in v0.18.0

type Filters map[string][]string

Filters is the Engine API's filters parameter: values by key, any value of a key matching, every key applying ("label" values all apply: "k", "k=v", "k!=v"). The engine refuses a key it does not know.

type HealthConfig added in v0.12.0

type HealthConfig struct {
	Test          []string `json:"Test,omitempty"`
	Interval      int64    `json:"Interval,omitempty"`
	Timeout       int64    `json:"Timeout,omitempty"`
	StartPeriod   int64    `json:"StartPeriod,omitempty"`
	StartInterval int64    `json:"StartInterval,omitempty"`
	Retries       int      `json:"Retries,omitempty"`
}

HealthConfig is a HEALTHCHECK (durations in nanoseconds).

type HostConfig

type HostConfig struct {
	Memory     int64 `json:"Memory"`
	AutoRemove bool  `json:"AutoRemove"`
	// Binds are "VOLUME:/path[:ro|:rw]"; named volumes only.
	Binds []string `json:"Binds,omitempty"`
	// NetworkMode is the network to join ("default", "none", a name).
	NetworkMode string `json:"NetworkMode,omitempty"`
	// DeviceRequests asks for devices (run --gpu: one request with the
	// capability "gpu").
	DeviceRequests []DeviceRequest `json:"DeviceRequests,omitempty"`
}

HostConfig is the create body's host part (a subset).

type ImageConfig added in v0.12.0

type ImageConfig struct {
	User         string              `json:"User,omitempty"`
	ExposedPorts map[string]struct{} `json:"ExposedPorts,omitempty"`
	Env          []string            `json:"Env,omitempty"`
	Cmd          StrSlice            `json:"Cmd,omitempty"`
	Entrypoint   StrSlice            `json:"Entrypoint,omitempty"`
	Volumes      map[string]struct{} `json:"Volumes,omitempty"`
	WorkingDir   string              `json:"WorkingDir,omitempty"`
	Labels       map[string]string   `json:"Labels,omitempty"`
	StopSignal   string              `json:"StopSignal,omitempty"`
	ArgsEscaped  bool                `json:"ArgsEscaped,omitempty"`
	Shell        []string            `json:"Shell,omitempty"`
	OnBuild      []string            `json:"OnBuild,omitempty"`
	Healthcheck  *HealthConfig       `json:"Healthcheck,omitempty"`
}

ImageConfig is an image's run configuration as Docker's API shows it (inspect Config) and takes it (the POST /commit body).

type ImageDeleteResponseItem

type ImageDeleteResponseItem struct {
	Untagged string `json:"Untagged,omitempty"`
	Deleted  string `json:"Deleted,omitempty"`
}

ImageDeleteResponseItem is one entry of DELETE /images/{name}.

type ImageHistory added in v0.12.0

type ImageHistory struct {
	Created    string `json:"created,omitempty"`
	CreatedBy  string `json:"created_by,omitempty"`
	Author     string `json:"author,omitempty"`
	Comment    string `json:"comment,omitempty"`
	EmptyLayer bool   `json:"empty_layer,omitempty"`
}

ImageHistory is one entry of an image's history.

type ImageInspect

type ImageInspect struct {
	ID           string           `json:"Id"`
	RepoTags     []string         `json:"RepoTags"`
	RepoDigests  []string         `json:"RepoDigests"`
	Created      string           `json:"Created"`
	Author       string           `json:"Author"`
	Architecture string           `json:"Architecture"`
	Os           string           `json:"Os"`
	Size         int64            `json:"Size"`
	Config       ImageConfig      `json:"Config"`
	RootFS       map[string]any   `json:"RootFS"`
	History      []ImageHistory   `json:"History,omitempty"`
	Metadata     map[string]any   `json:"Metadata,omitempty"`
	Descriptor   *json.RawMessage `json:"Descriptor,omitempty"`
}

ImageInspect is GET /images/{name}/json (a subset).

type ImagePruneResponse added in v0.4.0

type ImagePruneResponse struct {
	ImagesDeleted  []ImageDeleteResponseItem `json:"ImagesDeleted"`
	SpaceReclaimed int64                     `json:"SpaceReclaimed"`
}

ImagePruneResponse is POST /images/prune.

type ImageSummary

type ImageSummary struct {
	ID          string            `json:"Id"`
	ParentID    string            `json:"ParentId"`
	RepoTags    []string          `json:"RepoTags"`
	RepoDigests []string          `json:"RepoDigests"`
	Created     int64             `json:"Created"`
	Size        int64             `json:"Size"`
	SharedSize  int64             `json:"SharedSize"`
	Labels      map[string]string `json:"Labels"`
	Containers  int64             `json:"Containers"`
}

ImageSummary is one entry of GET /images/json.

type JSONMessage

type JSONMessage struct {
	Status      string        `json:"status,omitempty"`
	Stream      string        `json:"stream,omitempty"`
	ID          string        `json:"id,omitempty"`
	Error       string        `json:"error,omitempty"`
	ErrorDetail *JSONMsgError `json:"errorDetail,omitempty"`
}

JSONMessage is one line of the POST /images/create progress stream.

type JSONMsgError

type JSONMsgError struct {
	Message string `json:"message"`
}

JSONMsgError is the error detail of a JSONMessage.

type MemoryStats added in v0.7.0

type MemoryStats struct {
	Usage uint64 `json:"usage"`
	Limit uint64 `json:"limit"`
}

MemoryStats is the guest's linear memory and its limit.

type MountPoint added in v0.8.0

type MountPoint struct {
	Type        string `json:"Type"`
	Name        string `json:"Name"`
	Source      string `json:"Source"`
	Destination string `json:"Destination"`
	Driver      string `json:"Driver"`
	Mode        string `json:"Mode"`
	RW          bool   `json:"RW"`
}

MountPoint is one entry of an inspected container's Mounts.

type Network added in v0.10.0

type Network struct {
	Name       string                     `json:"Name"`
	ID         string                     `json:"Id"`
	Created    string                     `json:"Created"`
	Scope      string                     `json:"Scope"`
	Driver     string                     `json:"Driver"`
	EnableIPv6 bool                       `json:"EnableIPv6"`
	IPAM       NetworkIPAM                `json:"IPAM"`
	Internal   bool                       `json:"Internal"`
	Attachable bool                       `json:"Attachable"`
	Containers map[string]NetworkEndpoint `json:"Containers"`
	Options    map[string]string          `json:"Options"`
	Labels     map[string]string          `json:"Labels"`
}

Network is Docker's network object (GET /networks), a subset.

type NetworkConnectRequest added in v0.14.0

type NetworkConnectRequest struct {
	Container      string            `json:"Container"`
	EndpointConfig *EndpointSettings `json:"EndpointConfig,omitempty"`
}

NetworkConnectRequest is the body of POST /networks/{id}/connect.

type NetworkCreateRequest added in v0.10.0

type NetworkCreateRequest struct {
	Name     string            `json:"Name"`
	Driver   string            `json:"Driver,omitempty"`
	Internal bool              `json:"Internal,omitempty"`
	Labels   map[string]string `json:"Labels,omitempty"`
	Options  map[string]string `json:"Options,omitempty"`
}

NetworkCreateRequest is the body of POST /networks/create.

type NetworkCreateResponse added in v0.10.0

type NetworkCreateResponse struct {
	ID      string `json:"Id"`
	Warning string `json:"Warning"`
}

NetworkCreateResponse is the reply to POST /networks/create.

type NetworkDisconnectRequest added in v0.14.0

type NetworkDisconnectRequest struct {
	Container string `json:"Container"`
	Force     bool   `json:"Force,omitempty"`
}

NetworkDisconnectRequest is the body of POST /networks/{id}/disconnect.

type NetworkEndpoint added in v0.10.0

type NetworkEndpoint struct {
	Name        string `json:"Name"`
	IPv4Address string `json:"IPv4Address"`
}

NetworkEndpoint is a container on a network.

type NetworkIPAM added in v0.10.0

type NetworkIPAM struct {
	Driver string              `json:"Driver"`
	Config []map[string]string `json:"Config"`
}

NetworkIPAM is a network's address management.

type NetworkPruneResponse added in v0.14.0

type NetworkPruneResponse struct {
	NetworksDeleted []string `json:"NetworksDeleted"`
}

NetworkPruneResponse is POST /networks/prune.

type NetworkSettings added in v0.10.0

type NetworkSettings struct {
	IPAddress string                      `json:"IPAddress"`
	Networks  map[string]EndpointSettings `json:"Networks"`
}

NetworkSettings is an inspected container's networking (a subset).

type NetworkingConfig added in v0.14.0

type NetworkingConfig struct {
	EndpointsConfig map[string]*EndpointSettings `json:"EndpointsConfig,omitempty"`
}

NetworkingConfig is the create body's networking part: the networks' endpoint settings by network name (only Aliases is read).

type PidsStats added in v0.7.0

type PidsStats struct {
	Current uint64 `json:"current"`
}

PidsStats is the process count: 1 while running, else 0.

type StorageUsage added in v0.4.0

type StorageUsage struct {
	// Kind names the store: "directory /var/lib/wctr", "IndexedDB".
	Kind string `json:"Kind"`
	// Usage and Quota are bytes (-1: unknown); a browser reports its
	// estimate for the whole origin.
	Usage int64 `json:"Usage"`
	Quota int64 `json:"Quota"`
	// Persistent says the browser will not evict it under pressure.
	Persistent bool `json:"Persistent"`
	// Error is the last failure to store the engine's state, if any.
	Error string `json:"Error,omitempty"`
}

StorageUsage describes the engine's storage (see SystemDataUsage).

type StrSlice

type StrSlice []string

StrSlice accepts a JSON string or array of strings, as Docker's does for Cmd and Entrypoint; null stays nil ("use the image's").

func (*StrSlice) UnmarshalJSON

func (s *StrSlice) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SystemDataUsage added in v0.4.0

type SystemDataUsage struct {
	LayersSize int64              `json:"LayersSize"`
	Images     []ImageSummary     `json:"Images"`
	Containers []ContainerSummary `json:"Containers"`
	Volumes    []Volume           `json:"Volumes"`
	BuildCache []any              `json:"BuildCache"`
	// Storage is this engine's own addition: where its state lives and
	// how full that is. Docker clients ignore it.
	Storage *StorageUsage `json:"Storage,omitempty"`
}

SystemDataUsage is GET /system/df.

type SystemVersion

type SystemVersion struct {
	Platform      struct{ Name string } `json:"Platform"`
	Version       string                `json:"Version"`
	APIVersion    string                `json:"ApiVersion"`
	MinAPIVersion string                `json:"MinAPIVersion"`
	GitCommit     string                `json:"GitCommit"`
	GoVersion     string                `json:"GoVersion"`
	Os            string                `json:"Os"`
	Arch          string                `json:"Arch"`
	KernelVersion string                `json:"KernelVersion"`
	BuildTime     string                `json:"BuildTime,omitempty"`
}

SystemVersion is GET /version.

type Volume added in v0.8.0

type Volume struct {
	Name       string            `json:"Name"`
	Driver     string            `json:"Driver"`
	Mountpoint string            `json:"Mountpoint"`
	CreatedAt  string            `json:"CreatedAt"`
	Labels     map[string]string `json:"Labels"`
	Scope      string            `json:"Scope"`
	Options    map[string]string `json:"Options"`
	UsageData  *VolumeUsage      `json:"UsageData,omitempty"`
}

Volume is Docker's Volume object.

type VolumeCreateOptions added in v0.8.0

type VolumeCreateOptions struct {
	Name       string            `json:"Name"`
	Driver     string            `json:"Driver,omitempty"`
	DriverOpts map[string]string `json:"DriverOpts,omitempty"`
	Labels     map[string]string `json:"Labels,omitempty"`
}

VolumeCreateOptions is the body of POST /volumes/create.

type VolumeListResponse added in v0.8.0

type VolumeListResponse struct {
	Volumes  []Volume `json:"Volumes"`
	Warnings []string `json:"Warnings"`
}

VolumeListResponse is GET /volumes.

type VolumePruneResponse added in v0.8.0

type VolumePruneResponse struct {
	VolumesDeleted []string `json:"VolumesDeleted"`
	SpaceReclaimed int64    `json:"SpaceReclaimed"`
}

VolumePruneResponse is POST /volumes/prune.

type VolumeUsage added in v0.8.0

type VolumeUsage struct {
	Size     int64 `json:"Size"`
	RefCount int64 `json:"RefCount"`
}

VolumeUsage is a volume's size and how many containers reference it (GET /system/df).

type Waiter

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

Waiter is a registered wait: the daemon has acknowledged it, and Result blocks until the condition holds.

func (*Waiter) Result

func (w *Waiter) Result() (ContainerWaitResponse, error)

Result blocks for the wait's answer.

type WctrStatsInfo added in v0.7.0

type WctrStatsInfo struct {
	Running  bool  `json:"running"`
	SizeRw   int64 `json:"size_rw"`
	LogBytes int64 `json:"log_bytes"`
	// CPU says why the CPU fields are zero.
	CPU string `json:"cpu"`
}

WctrStatsInfo is this engine's addition to a stats reading.

Directories

Path Synopsis
Package inproc carries HTTP requests to a handler in the same process, with no socket: the browser has no unix sockets, so the playground's wctr talks to its engine through this transport instead.
Package inproc carries HTTP requests to a handler in the same process, with no socket: the browser has no unix sockets, so the playground's wctr talks to its engine through this transport instead.
Package server serves the engine's Docker Engine API subset over HTTP.
Package server serves the engine's Docker Engine API subset over HTTP.

Jump to

Keyboard shortcuts

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