Documentation ¶
Index ¶
- type AttachOptions
- type BuildResult
- type CPUStats
- type ComponentVersion
- type Container
- type ContainerConfig
- type ContainerCreateRequest
- type ContainerHostConfig
- type ContainerListItem
- type ExecConfig
- type ExecCreateResponse
- type ExecInspect
- type ExecProcessConfig
- type ExecResizeOptions
- type ExecStartCheck
- type ExecStartOptions
- type IPAM
- type ImageSummary
- type LogConfig
- type LogsOptions
- type NetworkCreateOption
- func WithAttachable(isAttachable bool) NetworkCreateOption
- func WithDriver(driver string) NetworkCreateOption
- func WithEnableIPv6(isIPv6 bool) NetworkCreateOption
- func WithIPAM(ipam IPAM) NetworkCreateOption
- func WithIngress(isIngress bool) NetworkCreateOption
- func WithInternal(isInternal bool) NetworkCreateOption
- func WithLabels(labels map[string]string) NetworkCreateOption
- func WithOptions(options map[string]string) NetworkCreateOption
- type NetworkCreateRequest
- type NetworkCreateResponse
- type NetworkInspectResponse
- type PushResult
- type PutArchiveOptions
- type RestartPolicy
- type Stats
- type StatsJSON
- type VersionInfo
- type VersionedRouter
- type VolumesListResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttachOptions ¶
type AttachOptions struct { GetStreams func() (io.Writer, io.Writer, chan os.Signal, func(), error) UseStdin bool UseStdout bool UseStderr bool Logs bool Stream bool // TODO: DetachKeys string MuxStreams bool }
AttachOptions defines the available options for the container attach call.
type BuildResult ¶
type BuildResult struct {
ID string
}
BuildResult contains the image id of a successful build From https://github.com/moby/moby/blob/v24.0.2/api/types/types.go#L774-L777
type CPUStats ¶
type CPUStats struct { // CPU Usage. Linux and Windows. CPUUsage dockertypes.CPUUsage `json:"cpu_usage"` // System Usage. Linux only. SystemUsage uint64 `json:"system_cpu_usage,omitempty"` // Online CPUs. Linux only. OnlineCPUs uint32 `json:"online_cpus,omitempty"` }
CPUStats aggregates and wraps all CPU related info of container From https://github.com/moby/moby/blob/v24.0.2/api/types/stats.go#L42-L55
type ComponentVersion ¶
type ComponentVersion struct { Name string Version string Details map[string]string `json:",omitempty"` }
ComponentVersion describes the version information for a specific component. From https://github.com/moby/moby/blob/v20.10.8/api/types/types.go#L112-L117
type Container ¶
type Container struct { ID string `json:"Id"` Created string Path string Args []string State *dockercompat.ContainerState Image string ResolvConfPath string HostnamePath string // TODO: HostsPath string LogPath string // Unimplemented: Node *ContainerNode `json:",omitempty"` // Node is only propagated by Docker Swarm standalone API Name string RestartCount int Driver string Platform string // TODO: MountLabel string // TODO: ProcessLabel string AppArmorProfile string Mounts []dockercompat.MountPoint Config *ContainerConfig NetworkSettings *dockercompat.NetworkSettings }
Container mimics a `docker container inspect` object. From https://github.com/moby/moby/blob/v24.0.2/api/types/types.go#L445-L486
type ContainerConfig ¶
type ContainerConfig struct { Hostname string `json:",omitempty"` // Hostname // TODO: Domainname string // Domainname User string `json:",omitempty"` // User that will run the command(s) inside the container, also support user:group AttachStdin bool // Attach the standard input, makes possible user interaction // TODO: AttachStdout bool // Attach the standard output // TODO: AttachStderr bool // Attach the standard error ExposedPorts nat.PortSet `json:",omitempty"` // List of exposed ports Tty bool // Attach standard streams to a tty, including stdin if it is not closed. // TODO: OpenStdin bool // Open stdin // TODO: StdinOnce bool // If true, close stdin after the 1 attached client disconnects. Env []string `json:",omitempty"` // List of environment variable to set in the container Cmd []string `json:",omitempty"` // Command to run when starting the container // TODO Healthcheck *HealthConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy // TODO: ArgsEscaped bool `json:",omitempty"` // True if command is already escaped (meaning treat as a command line) (Windows specific). Image string // Name of the image as it was passed by the operator (e.g. could be symbolic) Volumes map[string]struct{} `json:",omitempty"` // List of volumes (mounts) used for the container WorkingDir string `json:",omitempty"` // Current directory (PWD) in the command will be launched Entrypoint []string `json:",omitempty"` // Entrypoint to run when starting the container // TODO: NetworkDisabled bool `json:",omitempty"` // Is network disabled // TODO: MacAddress string `json:",omitempty"` // Mac Address of the container // TODO: OnBuild []string // ONBUILD metadata that were defined on the image Dockerfile Labels map[string]string `json:",omitempty"` // List of labels set to this container StopSignal string `json:",omitempty"` // Signal to stop a container StopTimeout *int `json:",omitempty"` // Timeout (in seconds) to stop a container }
ContainerConfig is from https://github.com/moby/moby/blob/v24.0.2/api/types/container/config.go#L64-L96
type ContainerCreateRequest ¶
type ContainerCreateRequest struct { ContainerConfig HostConfig ContainerHostConfig }
type ContainerHostConfig ¶
type ContainerHostConfig struct { // Applicable to all platforms Binds []string // List of volume bindings for this container // TODO: ContainerIDFile string // File (path) where the containerId is written LogConfig LogConfig // Configuration of the logs for this container NetworkMode string // Network mode to use for the container PortBindings nat.PortMap // Port mapping between the exposed port (container) and the host RestartPolicy RestartPolicy // Restart policy to be used for the container AutoRemove bool // Automatically remove container when it exits // Applicable to UNIX platforms CapAdd []string // List of kernel capabilities to add to the container // TODO: CapDrop strslice.StrSlice // List of kernel capabilities to remove from the container // TODO: CgroupnsMode CgroupnsMode // Cgroup namespace mode to use for the container DNS []string `json:"Dns"` // List of DNS server to lookup DNSOptions []string `json:"DnsOptions"` // List of DNSOption to look for DNSSearch []string `json:"DnsSearch"` // List of DNSSearch to look for ExtraHosts []string // List of extra hosts // Contains container's resources (cgroups, ulimits) Memory int64 // Memory limit (in bytes) }
HostConfig is from https://github.com/moby/moby/blob/v24.0.2/api/types/container/hostconfig.go#L376-L436
type ContainerListItem ¶
type ContainerListItem struct { Id string `json:"Id"` Names []string `json:"Names"` Image string CreatedAt int64 `json:"Created"` State string `json:"State"` Labels map[string]string NetworkSettings *dockercompat.NetworkSettings Mounts []dockercompat.MountPoint }
type ExecConfig ¶
type ExecConfig struct { User string // User that will run the command Privileged bool // Is the container in privileged mode Tty bool // Attach standard streams to a tty. ConsoleSize *[2]uint `json:",omitempty"` // Initial console size [height, width] AttachStdin bool // Attach the standard input, makes possible user interaction AttachStderr bool // Attach the standard error AttachStdout bool // Attach the standard output Detach bool // Execute in detach mode DetachKeys string // Escape keys for detach Env []string // Environment variables WorkingDir string // Working directory Cmd []string // Execution commands and args }
ExecConfig is from https://github.com/moby/moby/blob/454b6a7cf5187d1153159e5fe07f4b25c7a95e7f/api/types/configs.go#L30-L45
type ExecCreateResponse ¶
type ExecCreateResponse struct {
Id string
}
type ExecInspect ¶
type ExecInspect struct { ID string Running bool ExitCode *int ProcessConfig *ExecProcessConfig OpenStdin bool OpenStderr bool OpenStdout bool CanRemove bool ContainerID string DetachKeys []byte Pid int }
ExecInspect holds information about a running process started with docker exec. from https://github.com/moby/moby/blob/454b6a7cf5187d1153159e5fe07f4b25c7a95e7f/api/types/backend/backend.go#L77-L91
type ExecProcessConfig ¶
type ExecProcessConfig struct { Tty bool `json:"tty"` Entrypoint string `json:"entrypoint"` Arguments []string `json:"arguments"` Privileged *bool `json:"privileged,omitempty"` User string `json:"user,omitempty"` }
ExecProcessConfig holds information about the exec process running on the host. from https://github.com/moby/moby/blob/454b6a7cf5187d1153159e5fe07f4b25c7a95e7f/api/types/backend/backend.go#L93-L101
type ExecResizeOptions ¶
type ExecStartCheck ¶
type ExecStartCheck struct { // ExecStart will first check if it's detached Detach bool // Check if there's a tty Tty bool // Terminal size [height, width], unused if Tty == false ConsoleSize *[2]uint `json:",omitempty"` }
ExecStartCheck is from https://github.com/moby/moby/blob/454b6a7cf5187d1153159e5fe07f4b25c7a95e7f/api/types/types.go#L231-L240
type ExecStartOptions ¶
type ExecStartOptions struct { *ExecStartCheck ConID string ExecID string Stdin io.ReadCloser Stdout io.Writer Stderr io.Writer SuccessResponse func() }
type IPAM ¶
type IPAM struct { // Driver is the name of the IPAM driver to use. Driver string `json:"Driver" default:"default"` // Config is a list of IPAM configuration options. Config []map[string]string `json:"Config"` // Options are driver-specific options as a key-value mapping. Options map[string]string `json:"Options"` }
IPAM is a data class for simple JSON marshalling/unmarshalling of IP Address Management (IPAM) network configuration.
Reference: https://github.com/moby/libnetwork/blob/2267b2527259eff27aa330b35de964afbbb4392e/docs/ipam.md
type ImageSummary ¶
type ImageSummary struct { ID string `json:"Id"` RepoTags []string RepoDigests []string Created int64 Size int64 }
ImageSummary models a single item in the list response to /images/json in the Docker API. https://docs.docker.com/engine/api/v1.40/#operation/ImageList
type LogConfig ¶
LogConfig represents the logging configuration of the container. From https://github.com/moby/moby/blob/v24.0.2/api/types/container/hostconfig.go#L319-L323
type LogsOptions ¶
type LogsOptions struct { GetStreams func() (io.Writer, io.Writer, chan os.Signal, func(), error) Stdout bool Stderr bool Follow bool Since int64 Until int64 Timestamps bool Tail string MuxStreams bool }
LogsOptions defines the available options for the container logs call.
type NetworkCreateOption ¶
type NetworkCreateOption func(*NetworkCreateRequest)
NetworkCreateOption is a utility type for setting create network configuration on requests via options.
func WithAttachable ¶
func WithAttachable(isAttachable bool) NetworkCreateOption
WithAttachable enables/disables manual container attachment.
func WithDriver ¶
func WithDriver(driver string) NetworkCreateOption
WithDriver configures the name of the network driver to use.
func WithEnableIPv6 ¶
func WithEnableIPv6(isIPv6 bool) NetworkCreateOption
WithEnableIPv6 enables/disables Internet Protocol version 6 (IPv6) networking.
func WithIPAM ¶
func WithIPAM(ipam IPAM) NetworkCreateOption
WithIPAM configures the IP Address Management (IPAM) driver configuration and options.
func WithIngress ¶
func WithIngress(isIngress bool) NetworkCreateOption
WithIngress enables/disables creating ingress network with routing-mesh in swarm mode.
func WithInternal ¶
func WithInternal(isInternal bool) NetworkCreateOption
WithInternal enables/disables internal-only access to the network.
func WithLabels ¶
func WithLabels(labels map[string]string) NetworkCreateOption
WithLabels configures user-defined key-value metadata on a network.
func WithOptions ¶
func WithOptions(options map[string]string) NetworkCreateOption
WithOptions configures network driver specific options.
type NetworkCreateRequest ¶
type NetworkCreateRequest struct { // Name is the network's name. Name string `json:"Name"` // CheckDuplicate specifies to check for networks with duplicate names. // // Deprecated: The backend (nerdctl) will always check for collisions. CheckDuplicate bool `json:"CheckDuplicate"` // Driver is the name of the network driver plugin to use. Driver string `json:"Driver" default:"bridge"` // Internal specifies to restrict external access to the network. // // Internal networks are not currently supported. Internal bool `json:"Internal"` // Attachable specifies if a globally scoped network is manually attachable // by regular containers from workers in swarm mode. // // Attachable networks are not currently supported. Attachable bool `json:"Attachable"` // Ingress specifies if the network should be an ingress network and provide // the routing-mesh in swarm mode. // // Ingress networks are not currently supported. Ingress bool `json:"Ingress"` // IPAM specifies customer IP Address Management (IPAM) configuration. IPAM IPAM `json:"IPAM"` // EnableIPv6 specifies to enable IPv6 on the network. EnableIPv6 bool `json:"EnableIPv6"` // Options specifies network specific options to be used by the drivers. Options map[string]string `json:"Options"` // Labels are user-defined key-value network metadata Labels map[string]string `json:"Labels"` }
NetworkCreateRequest is a data class for simple JSON marshalling/unmarshalling of /networks/create messages into HTTP Post requests.
Reference: https://docs.docker.com/engine/api/v1.43/#tag/Network/operation/NetworkCreate
Example:
{ "Name": "isolated_nw", "CheckDuplicate": false, "Driver": "bridge", "EnableIPv6": true, "IPAM": { "Driver": "default", "Config": [ { "Subnet": "172.20.0.0/16", "IPRange": "172.20.10.0/24", "Gateway": "172.20.10.11" }, { "Subnet": "2001:db8:abcd::/64", "Gateway": "2001:db8:abcd::1011" } ], "Options": { "foo": "bar" } }, "Internal": true, "Attachable": false, "Ingress": false, "Options": { "com.docker.network.bridge.default_bridge": "true", "com.docker.network.bridge.enable_icc": "true", "com.docker.network.bridge.enable_ip_masquerade": "true", "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", "com.docker.network.bridge.name": "docker0", "com.docker.network.driver.mtu": "1500" }, "Labels": { "com.example.some-label": "some-value", "com.example.some-other-label": "some-other-value" } }
func NewCreateNetworkRequest ¶
func NewCreateNetworkRequest(name string, opts ...NetworkCreateOption) *NetworkCreateRequest
NewCreateNetworkRequest is a utility function for instantiating create network requests with both required and optional configuration.
type NetworkCreateResponse ¶
type NetworkCreateResponse struct { // ID is the unique identification document for the network that was created. ID string `json:"Id"` // Warning is used to communicate any issues which occurred during network configuration. Warning string `json:"Warning,omitempty"` }
NetworkCreateResponse is a data class for simple JSON marshalling/unmarshalling of /networks/create messages into HTTP Post responses.
Reference: https://docs.docker.com/engine/api/v1.43/#tag/Network/operation/NetworkCreate
Example:
{ "Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30", "Warning": "" }
type NetworkInspectResponse ¶
type NetworkInspectResponse 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"` // Internal bool `json:"Internal"` // Attachable bool `json:"Attachable"` // Ingress bool `json:"Ingress"` IPAM dockercompat.IPAM `json:"IPAM,omitempty"` // Containers ContainersType `json:"Containers"` // Options OptionsType `json:"Options"` Labels map[string]string `json:"Labels,omitempty"` }
NetworkInspectResponse models a single network object in response to /networks/{id}.
type PushResult ¶
PushResult contains the tag, manifest digest, and manifest size from the push. It's used to signal this information to the trust code in the client so it can sign the manifest if necessary. From https://github.com/moby/moby/blob/v24.0.2/api/types/types.go#L765-L772
type PutArchiveOptions ¶
PutArchiveOptions defines the parameters for [PutContainerArchive API](https://docs.docker.com/engine/api/v1.41/#tag/Container/operation/PutContainerArchive)
type RestartPolicy ¶
RestartPolicy represents the restart policies of the container. From https://github.com/moby/moby/blob/v24.0.2/api/types/container/hostconfig.go#L272-L276
type Stats ¶
type Stats struct { // Common stats Read time.Time `json:"read"` PreRead time.Time `json:"preread"` // Linux specific stats, not populated on Windows. PidsStats dockertypes.PidsStats `json:"pids_stats,omitempty"` BlkioStats dockertypes.BlkioStats `json:"blkio_stats,omitempty"` // Shared stats CPUStats CPUStats `json:"cpu_stats,omitempty"` PreCPUStats CPUStats `json:"precpu_stats,omitempty"` // "Pre"="Previous" MemoryStats dockertypes.MemoryStats `json:"memory_stats,omitempty"` }
Stats is Ultimate struct aggregating all types of stats of one container From https://github.com/moby/moby/blob/v24.0.2/api/types/stats.go#L152-L170
type StatsJSON ¶
type StatsJSON struct { Stats Name string `json:"name,omitempty"` ID string `json:"id,omitempty"` // Networks request version >=1.21 Networks map[string]dockertypes.NetworkStats `json:"networks,omitempty"` }
StatsJSON is the JSON response for container stats api From https://github.com/moby/moby/blob/v24.0.2/api/types/stats.go#L172-L181
type VersionInfo ¶
type VersionInfo struct { Platform struct { Name string } Version string ApiVersion string MinAPIVersion string GitCommit string Os string Arch string KernelVersion string Experimental bool BuildTime string Components []ComponentVersion }
VersionInfo contains the response of /version api.
type VersionedRouter ¶
VersionedRouter wraps the router to provide a router that can redirect routes to either a versioned path or a non-versioned path.
func (*VersionedRouter) HandleFunc ¶
func (vr *VersionedRouter) HandleFunc(path string, f func(http.ResponseWriter, *http.Request), methods ...string)
HandleFunc replaces the router.HandleFunc function to create a new handler and direct certain paths to certain functions.
func (*VersionedRouter) SetPrefix ¶
func (vr *VersionedRouter) SetPrefix(prefix string)
SetPrefix sets the prefix of the route, so that any specified routes can just specify the endpoint only.
type VolumesListResponse ¶
VolumesListResponse is the response object expected by GET /volumes https://docs.docker.com/engine/api/v1.40/#tag/Volume