Documentation
¶
Index ¶
- Constants
- func ValidateContainerState(s ContainerState) error
- func ValidateHealthStatus(s HealthStatus) error
- func ValidateRestartPolicy(policy RestartPolicy) error
- type BlkioStatEntry
- type BlkioStats
- type CPUStats
- type CPUUsage
- type CgroupSpec
- type CgroupnsMode
- type ChangeType
- type CommitResponse
- type Config
- type ContainerState
- type CreateRequest
- type CreateResponse
- type DeviceMapping
- type DeviceRequest
- type DiskUsage
- type ExecCreateRequest
- type ExecCreateResponse
- type ExecInspectResponse
- type ExecProcessConfig
- type ExecStartRequest
- type FilesystemChange
- type Health
- type HealthConfig
- type HealthStatus
- type HealthSummary
- type HealthcheckResult
- type HostConfig
- type InspectResponse
- type IpcMode
- type Isolation
- type LogConfig
- type LogMode
- type MemoryStats
- type MountPoint
- type NetworkMode
- func (n NetworkMode) ConnectedContainer() (idOrName string)
- func (n NetworkMode) IsBridge() bool
- func (n NetworkMode) IsContainer() bool
- func (n NetworkMode) IsDefault() bool
- func (n NetworkMode) IsHost() bool
- func (n NetworkMode) IsNone() bool
- func (n NetworkMode) IsPrivate() bool
- func (n NetworkMode) IsUserDefined() bool
- func (n NetworkMode) NetworkName() string
- func (n NetworkMode) UserDefined() string
- type NetworkSettings
- type NetworkSettingsSummary
- type NetworkStats
- type PathStat
- type PidMode
- type PidsStats
- type PortSummary
- type PruneReport
- type Resources
- type RestartPolicy
- type RestartPolicyMode
- type State
- type StatsResponse
- type StorageStats
- type Summary
- type ThrottlingData
- type TopResponse
- type UTSMode
- type Ulimit
- type UpdateConfig
- type UpdateResponse
- type UsernsMode
- type WaitCondition
- type WaitExitError
- type WaitResponse
Constants ¶
const MinimumDuration = 1 * time.Millisecond
MinimumDuration puts a minimum on user configured duration. This is to prevent API error on time unit. For example, API may set 3 as healthcheck interval with intention of 3 seconds, but Docker interprets it as 3 nanoseconds.
Variables ¶
This section is empty.
Functions ¶
func ValidateContainerState ¶
func ValidateContainerState(s ContainerState) error
ValidateContainerState checks if the provided string is a valid container ContainerState.
func ValidateHealthStatus ¶
func ValidateHealthStatus(s HealthStatus) error
ValidateHealthStatus checks if the provided string is a valid container HealthStatus.
func ValidateRestartPolicy ¶
func ValidateRestartPolicy(policy RestartPolicy) error
ValidateRestartPolicy validates the given RestartPolicy.
Types ¶
type BlkioStatEntry ¶
type BlkioStatEntry struct {
Major uint64 `json:"major"`
Minor uint64 `json:"minor"`
Op string `json:"op"`
Value uint64 `json:"value"`
}
BlkioStatEntry is one small entity to store a piece of Blkio stats Not used on Windows.
type BlkioStats ¶
type BlkioStats struct {
// number of bytes transferred to and from the block device
IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive"`
IoServicedRecursive []BlkioStatEntry `json:"io_serviced_recursive"`
IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive"`
IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive"`
IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive"`
IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive"`
IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive"`
SectorsRecursive []BlkioStatEntry `json:"sectors_recursive"`
}
BlkioStats stores All IO service stats for data read and write. This is a Linux specific structure as the differences between expressing block I/O on Windows and Linux are sufficiently significant to make little sense attempting to morph into a combined structure.
type CPUStats ¶
type CPUStats struct {
// CPU Usage. Linux and Windows.
CPUUsage 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"`
// Throttling Data. Linux only.
ThrottlingData ThrottlingData `json:"throttling_data,omitempty"`
}
CPUStats aggregates and wraps all CPU related info of container
type CPUUsage ¶
type CPUUsage struct {
// Total CPU time consumed.
// Units: nanoseconds (Linux)
// Units: 100's of nanoseconds (Windows)
TotalUsage uint64 `json:"total_usage"`
// Total CPU time consumed per core (Linux). Not used on Windows.
// Units: nanoseconds.
PercpuUsage []uint64 `json:"percpu_usage,omitempty"`
// Time spent by tasks of the cgroup in kernel mode (Linux).
// Time spent by all container processes in kernel mode (Windows).
// Units: nanoseconds (Linux).
// Units: 100's of nanoseconds (Windows). Not populated for Hyper-V Containers.
UsageInKernelmode uint64 `json:"usage_in_kernelmode"`
// Time spent by tasks of the cgroup in user mode (Linux).
// Time spent by all container processes in user mode (Windows).
// Units: nanoseconds (Linux).
// Units: 100's of nanoseconds (Windows). Not populated for Hyper-V Containers
UsageInUsermode uint64 `json:"usage_in_usermode"`
}
CPUUsage stores All CPU stats aggregated since container inception.
type CgroupSpec ¶
type CgroupSpec string
CgroupSpec represents the cgroup to use for the container.
func (CgroupSpec) Container ¶
func (c CgroupSpec) Container() (idOrName string)
Container returns the ID or name of the container whose cgroup will be used.
func (CgroupSpec) IsContainer ¶
func (c CgroupSpec) IsContainer() bool
IsContainer indicates whether the container is using another container cgroup
func (CgroupSpec) Valid ¶
func (c CgroupSpec) Valid() bool
Valid indicates whether the cgroup spec is valid.
type CgroupnsMode ¶
type CgroupnsMode string
CgroupnsMode represents the cgroup namespace mode of the container
const ( CgroupnsModeEmpty CgroupnsMode = "" CgroupnsModePrivate CgroupnsMode = "private" CgroupnsModeHost CgroupnsMode = "host" )
cgroup namespace modes for containers
func (CgroupnsMode) IsEmpty ¶
func (c CgroupnsMode) IsEmpty() bool
IsEmpty indicates whether the container cgroup namespace mode is unset
func (CgroupnsMode) IsHost ¶
func (c CgroupnsMode) IsHost() bool
IsHost indicates whether the container shares the host's cgroup namespace
func (CgroupnsMode) IsPrivate ¶
func (c CgroupnsMode) IsPrivate() bool
IsPrivate indicates whether the container uses its own private cgroup namespace
func (CgroupnsMode) Valid ¶
func (c CgroupnsMode) Valid() bool
Valid indicates whether the cgroup namespace mode is valid
type ChangeType ¶
type ChangeType uint8
ChangeType Kind of change
Can be one of:
- `0`: Modified ("C") - `1`: Added ("A") - `2`: Deleted ("D")
swagger:model ChangeType
const ( // ChangeModify represents the modify operation. ChangeModify ChangeType = 0 // ChangeAdd represents the add operation. ChangeAdd ChangeType = 1 // ChangeDelete represents the delete operation. ChangeDelete ChangeType = 2 )
func (ChangeType) String ¶
func (ct ChangeType) String() string
type CommitResponse ¶
type CommitResponse = common.IDResponse
CommitResponse response for the commit API call, containing the ID of the image that was produced.
type Config ¶
type Config struct {
Hostname string // Hostname
Domainname string // Domainname
User string // User that will run the command(s) inside the container, also support user:group
AttachStdin bool // Attach the standard input, makes possible user interaction
AttachStdout bool // Attach the standard output
AttachStderr bool // Attach the standard error
ExposedPorts network.PortSet `json:",omitempty"` // List of exposed ports
Tty bool // Attach standard streams to a tty, including stdin if it is not closed.
OpenStdin bool // Open stdin
StdinOnce bool // If true, close stdin after the 1 attached client disconnects.
Env []string // List of environment variable to set in the container
Cmd []string // Command to run when starting the container
Healthcheck *HealthConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy
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{} // List of volumes (mounts) used for the container
WorkingDir string // Current directory (PWD) in the command will be launched
Entrypoint []string // Entrypoint to run when starting the container
NetworkDisabled bool `json:",omitempty"` // Is network disabled
OnBuild []string `json:",omitempty"` // ONBUILD metadata that were defined on the image Dockerfile
Labels map[string]string // 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
Shell []string `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT
}
Config contains the configuration data about a container. It should hold only portable information about the container. Here, "portable" means "independent from the host we are running on". Non-portable information *should* appear in HostConfig. All fields added to this struct must be marked `omitempty` to keep getting predictable hashes from the old `v1Compatibility` configuration.
type ContainerState ¶
type ContainerState string
ContainerState is a string representation of the container's current state.
const ( StateCreated ContainerState = "created" // StateCreated indicates the container is created, but not (yet) started. StateRunning ContainerState = "running" // StateRunning indicates that the container is running. StatePaused ContainerState = "paused" // StatePaused indicates that the container's current state is paused. StateRestarting ContainerState = "restarting" // StateRestarting indicates that the container is currently restarting. StateRemoving ContainerState = "removing" // StateRemoving indicates that the container is being removed. StateExited ContainerState = "exited" // StateExited indicates that the container exited. StateDead ContainerState = "dead" // StateDead indicates that the container failed to be deleted. Containers in this state are attempted to be cleaned up when the daemon restarts. )
type CreateRequest ¶
type CreateRequest struct {
*Config
HostConfig *HostConfig `json:"HostConfig,omitempty"`
NetworkingConfig *network.NetworkingConfig `json:"NetworkingConfig,omitempty"`
}
CreateRequest is the request message sent to the server for container create calls. It is a config wrapper that holds the container Config (portable) and the corresponding HostConfig (non-portable) and network.NetworkingConfig.
type CreateResponse ¶
type CreateResponse struct {
// The ID of the created container
// Example: ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743
// Required: true
ID string `json:"Id"`
// Warnings encountered when creating the container
// Example: []
// Required: true
Warnings []string `json:"Warnings"`
}
CreateResponse ContainerCreateResponse
OK response to ContainerCreate operation ¶
swagger:model CreateResponse
type DeviceMapping ¶
DeviceMapping represents the device mapping between the host and the container.
type DeviceRequest ¶
type DeviceRequest struct {
Driver string // Name of device driver
Count int // Number of devices to request (-1 = All)
DeviceIDs []string // List of device IDs as recognizable by the device driver
Capabilities [][]string // An OR list of AND lists of device capabilities (e.g. "gpu")
Options map[string]string // Options to pass onto the device driver
}
DeviceRequest represents a request for devices from a device driver. Used by GPU device drivers.
type DiskUsage ¶
type DiskUsage struct {
// Count of active containers.
//
// Example: 1
ActiveCount int64 `json:"ActiveCount,omitempty"`
// List of container summaries.
//
Items []Summary `json:"Items,omitempty"`
// Disk space that can be reclaimed by removing inactive containers.
//
// Example: 12345678
Reclaimable int64 `json:"Reclaimable,omitempty"`
// Count of all containers.
//
// Example: 4
TotalCount int64 `json:"TotalCount,omitempty"`
// Disk space in use by containers.
//
// Example: 98765432
TotalSize int64 `json:"TotalSize,omitempty"`
}
DiskUsage represents system data usage information for container resources.
swagger:model DiskUsage
type ExecCreateRequest ¶
type ExecCreateRequest 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
DetachKeys string // Escape keys for detach
Env []string // Environment variables
WorkingDir string // Working directory
Cmd []string // Execution commands and args
}
ExecCreateRequest is a small subset of the Config struct that holds the configuration for the exec feature of docker.
type ExecCreateResponse ¶
type ExecCreateResponse = common.IDResponse
ExecCreateResponse is the response for a successful exec-create request. It holds the ID of the exec that was created.
TODO(thaJeztah): make this a distinct type.
type ExecInspectResponse ¶
type ExecInspectResponse struct {
ID string `json:"ID"`
Running bool `json:"Running"`
ExitCode *int `json:"ExitCode"`
ProcessConfig *ExecProcessConfig
OpenStdin bool `json:"OpenStdin"`
OpenStderr bool `json:"OpenStderr"`
OpenStdout bool `json:"OpenStdout"`
CanRemove bool `json:"CanRemove"`
ContainerID string `json:"ContainerID"`
DetachKeys []byte `json:"DetachKeys"`
Pid int `json:"Pid"`
}
ExecInspectResponse is the API response for the "GET /exec/{id}/json" endpoint and holds information about and exec.
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.
type ExecStartRequest ¶
type ExecStartRequest 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"`
}
ExecStartRequest is a temp struct used by execStart Config fields is part of ExecConfig in runconfig package
type FilesystemChange ¶
type FilesystemChange struct {
// kind
// Required: true
Kind ChangeType `json:"Kind"`
// Path to file or directory that has changed.
//
// Required: true
Path string `json:"Path"`
}
FilesystemChange Change in the container's filesystem.
swagger:model FilesystemChange
type Health ¶
type Health struct {
Status HealthStatus // Status is one of [Starting], [Healthy] or [Unhealthy].
FailingStreak int // FailingStreak is the number of consecutive failures
Log []*HealthcheckResult // Log contains the last few results (oldest first)
}
Health stores information about the container's healthcheck results
type HealthConfig ¶
type HealthConfig = dockerspec.HealthcheckConfig
HealthConfig holds configuration settings for the HEALTHCHECK feature.
type HealthStatus ¶
type HealthStatus string
HealthStatus is a string representation of the container's health.
const ( NoHealthcheck HealthStatus = "none" // Indicates there is no healthcheck Starting HealthStatus = "starting" // Starting indicates that the container is not yet ready Healthy HealthStatus = "healthy" // Healthy indicates that the container is running correctly Unhealthy HealthStatus = "unhealthy" // Unhealthy indicates that the container has a problem )
Health states
type HealthSummary ¶
type HealthSummary struct {
Status HealthStatus // Status is one of [NoHealthcheck], [Starting], [Healthy] or [Unhealthy].
FailingStreak int // FailingStreak is the number of consecutive failures
}
HealthSummary stores a summary of the container's healthcheck results.
type HealthcheckResult ¶
type HealthcheckResult struct {
Start time.Time // Start is the time this check started
End time.Time // End is the time this check ended
ExitCode int // ExitCode meanings: 0=healthy, 1=unhealthy, 2=reserved (considered unhealthy), else=error running probe
Output string // Output from last check
}
HealthcheckResult stores information about a single run of a healthcheck probe
type HostConfig ¶
type HostConfig struct {
// Applicable to all platforms
Binds []string // List of volume bindings for this container
ContainerIDFile string // File (path) where the containerId is written
LogConfig LogConfig // Configuration of the logs for this container
NetworkMode NetworkMode // Network mode to use for the container
PortBindings network.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
VolumeDriver string // Name of the volume driver used to mount volumes
VolumesFrom []string // List of volumes to take from other container
ConsoleSize [2]uint // Initial console size (height,width)
Annotations map[string]string `json:",omitempty"` // Arbitrary non-identifying metadata attached to container and provided to the runtime
// Applicable to UNIX platforms
CapAdd []string // List of kernel capabilities to add to the container
CapDrop []string // List of kernel capabilities to remove from the container
CgroupnsMode CgroupnsMode // Cgroup namespace mode to use for the container
DNS []netip.Addr `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
GroupAdd []string // List of additional groups that the container process will run as
IpcMode IpcMode // IPC namespace to use for the container
Cgroup CgroupSpec // Cgroup to use for the container
Links []string // List of links (in the name:alias form)
OomScoreAdj int // Container preference for OOM-killing
PidMode PidMode // PID namespace to use for the container
Privileged bool // Is the container in privileged mode
PublishAllPorts bool // Should docker publish all exposed port for the container
ReadonlyRootfs bool // Is the container root filesystem in read-only
SecurityOpt []string // List of string values to customize labels for MLS systems, such as SELinux.
StorageOpt map[string]string `json:",omitempty"` // Storage driver options per container.
Tmpfs map[string]string `json:",omitempty"` // List of tmpfs (mounts) used for the container
UTSMode UTSMode // UTS namespace to use for the container
UsernsMode UsernsMode // The user namespace to use for the container
ShmSize int64 // Total shm memory usage
Sysctls map[string]string `json:",omitempty"` // List of Namespaced sysctls used for the container
Runtime string `json:",omitempty"` // Runtime to use with this container
// Applicable to Windows
Isolation Isolation // Isolation technology of the container (e.g. default, hyperv)
// Contains container's resources (cgroups, ulimits)
Resources
// Mounts specs used by the container
Mounts []mount.Mount `json:",omitempty"`
// MaskedPaths is the list of paths to be masked inside the container (this overrides the default set of paths)
MaskedPaths []string
// ReadonlyPaths is the list of paths to be set as read-only inside the container (this overrides the default set of paths)
ReadonlyPaths []string
// Run a custom init inside the container, if null, use the daemon's configured settings
Init *bool `json:",omitempty"`
}
HostConfig the non-portable Config structure of a container. Here, "non-portable" means "dependent of the host we are running on". Portable information *should* appear in Config.
type InspectResponse ¶
type InspectResponse struct {
ID string `json:"Id"`
Created string
Path string
Args []string
State *State
Image string
ResolvConfPath string
HostnamePath string
HostsPath string
LogPath string
Name string
RestartCount int
Driver string
Platform string
MountLabel string
ProcessLabel string
AppArmorProfile string
ExecIDs []string
HostConfig *HostConfig
// GraphDriver contains information about the container's graph driver.
GraphDriver *storage.DriverData `json:"GraphDriver,omitempty"`
// Storage contains information about the storage used for the container's filesystem.
Storage *storage.Storage `json:"Storage,omitempty"`
SizeRw *int64 `json:",omitempty"`
SizeRootFs *int64 `json:",omitempty"`
Mounts []MountPoint
Config *Config
NetworkSettings *NetworkSettings
// ImageManifestDescriptor is the descriptor of a platform-specific manifest of the image used to create the container.
ImageManifestDescriptor *ocispec.Descriptor `json:"ImageManifestDescriptor,omitempty"`
}
InspectResponse is the response for the GET "/containers/{name:.*}/json" endpoint.
type IpcMode ¶
type IpcMode string
IpcMode represents the container ipc stack.
const ( IPCModeNone IpcMode = "none" IPCModeHost IpcMode = "host" IPCModeContainer IpcMode = "container" IPCModePrivate IpcMode = "private" )
IpcMode constants
func (IpcMode) Container ¶
Container returns the name of the container ipc stack is going to be used.
func (IpcMode) IsContainer ¶
IsContainer indicates whether the container uses another container's ipc namespace.
func (IpcMode) IsPrivate ¶
IsPrivate indicates whether the container uses its own private ipc namespace which can not be shared.
func (IpcMode) IsShareable ¶
IsShareable indicates whether the container's ipc namespace can be shared with another container.
type Isolation ¶
type Isolation string
Isolation represents the isolation technology of a container. The supported values are platform specific
const ( IsolationEmpty Isolation = "" // IsolationEmpty is unspecified (same behavior as default) IsolationDefault Isolation = "default" // IsolationDefault is the default isolation mode on current daemon IsolationProcess Isolation = "process" // IsolationProcess is process isolation mode IsolationHyperV Isolation = "hyperv" // IsolationHyperV is HyperV isolation mode )
Isolation modes for containers
func (Isolation) IsDefault ¶
IsDefault indicates the default isolation technology of a container. On Linux this is the native driver. On Windows, this is a Windows Server Container.
type LogMode ¶
type LogMode string
LogMode is a type to define the available modes for logging These modes affect how logs are handled when log messages start piling up.
type MemoryStats ¶
type MemoryStats struct {
// current res_counter usage for memory
Usage uint64 `json:"usage,omitempty"`
// maximum usage ever recorded.
MaxUsage uint64 `json:"max_usage,omitempty"`
// TODO(vishh): Export these as stronger types.
// all the stats exported via memory.stat.
Stats map[string]uint64 `json:"stats,omitempty"`
// number of times memory usage hits limits.
Failcnt uint64 `json:"failcnt,omitempty"`
Limit uint64 `json:"limit,omitempty"`
// committed bytes
Commit uint64 `json:"commitbytes,omitempty"`
// peak committed bytes
CommitPeak uint64 `json:"commitpeakbytes,omitempty"`
// private working set
PrivateWorkingSet uint64 `json:"privateworkingset,omitempty"`
}
MemoryStats aggregates all memory stats since container inception on Linux. Windows returns stats for commit and private working set only.
type MountPoint ¶
type MountPoint struct {
// Type is the type of mount, see [mount.Type] definitions for details.
Type mount.Type `json:",omitempty"`
// Name is the name reference to the underlying data defined by `Source`
// e.g., the volume name.
Name string `json:",omitempty"`
// Source is the source location of the mount.
//
// For volumes, this contains the storage location of the volume (within
// `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains
// the source (host) part of the bind-mount. For `tmpfs` mount points, this
// field is empty.
Source string
// Destination is the path relative to the container root (`/`) where the
// Source is mounted inside the container.
Destination string
// Driver is the volume driver used to create the volume (if it is a volume).
Driver string `json:",omitempty"`
// Mode is a comma separated list of options supplied by the user when
// creating the bind/volume mount.
//
// The default is platform-specific (`"z"` on Linux, empty on Windows).
Mode string
// RW indicates whether the mount is mounted writable (read-write).
RW bool
// Propagation describes how mounts are propagated from the host into the
// mount point, and vice-versa. Refer to the Linux kernel documentation
// for details:
// https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt
//
// This field is not used on Windows.
Propagation mount.Propagation
}
MountPoint represents a mount point configuration inside the container. This is used for reporting the mountpoints in use by a container.
type NetworkMode ¶
type NetworkMode string
NetworkMode represents the container network stack.
func (NetworkMode) ConnectedContainer ¶
func (n NetworkMode) ConnectedContainer() (idOrName string)
ConnectedContainer is the id of the container which network this container is connected to.
func (NetworkMode) IsBridge ¶
func (n NetworkMode) IsBridge() bool
IsBridge indicates whether container uses the bridge network stack
func (NetworkMode) IsContainer ¶
func (n NetworkMode) IsContainer() bool
IsContainer indicates whether container uses a container network stack.
func (NetworkMode) IsDefault ¶
func (n NetworkMode) IsDefault() bool
IsDefault indicates whether container uses the default network stack.
func (NetworkMode) IsHost ¶
func (n NetworkMode) IsHost() bool
IsHost indicates whether container uses the host network stack.
func (NetworkMode) IsNone ¶
func (n NetworkMode) IsNone() bool
IsNone indicates whether container isn't using a network stack.
func (NetworkMode) IsPrivate ¶
func (n NetworkMode) IsPrivate() bool
IsPrivate indicates whether container uses its private network stack.
func (NetworkMode) IsUserDefined ¶
func (n NetworkMode) IsUserDefined() bool
IsUserDefined indicates user-created network
func (NetworkMode) NetworkName ¶
func (n NetworkMode) NetworkName() string
NetworkName returns the name of the network stack.
func (NetworkMode) UserDefined ¶
func (n NetworkMode) UserDefined() string
UserDefined indicates user-created network
type NetworkSettings ¶
type NetworkSettings struct {
SandboxID string // SandboxID uniquely represents a container's network stack
SandboxKey string // SandboxKey identifies the sandbox
// Ports is a collection of [network.PortBinding] indexed by [network.Port]
Ports network.PortMap
Networks map[string]*network.EndpointSettings
}
NetworkSettings exposes the network settings in the api
type NetworkSettingsSummary ¶
type NetworkSettingsSummary struct {
Networks map[string]*network.EndpointSettings
}
NetworkSettingsSummary provides a summary of container's networks in /containers/json
type NetworkStats ¶
type NetworkStats struct {
// Bytes received. Windows and Linux.
RxBytes uint64 `json:"rx_bytes"`
// Packets received. Windows and Linux.
RxPackets uint64 `json:"rx_packets"`
// Received errors. Not used on Windows. Note that we don't `omitempty` this
// field as it is expected in the >=v1.21 API stats structure.
RxErrors uint64 `json:"rx_errors"`
// Incoming packets dropped. Windows and Linux.
RxDropped uint64 `json:"rx_dropped"`
// Bytes sent. Windows and Linux.
TxBytes uint64 `json:"tx_bytes"`
// Packets sent. Windows and Linux.
TxPackets uint64 `json:"tx_packets"`
// Sent errors. Not used on Windows. Note that we don't `omitempty` this
// field as it is expected in the >=v1.21 API stats structure.
TxErrors uint64 `json:"tx_errors"`
// Outgoing packets dropped. Windows and Linux.
TxDropped uint64 `json:"tx_dropped"`
// Endpoint ID. Not used on Linux.
EndpointID string `json:"endpoint_id,omitempty"`
// Instance ID. Not used on Linux.
InstanceID string `json:"instance_id,omitempty"`
}
NetworkStats aggregates the network stats of one container
type PathStat ¶
type PathStat struct {
Name string `json:"name"`
Size int64 `json:"size"`
Mode os.FileMode `json:"mode"`
Mtime time.Time `json:"mtime"`
LinkTarget string `json:"linkTarget"`
}
PathStat is used to encode the header from GET "/containers/{name:.*}/archive" "Name" is the file or directory name.
type PidMode ¶
type PidMode string
PidMode represents the pid namespace of the container.
func (PidMode) Container ¶
Container returns the name of the container whose pid namespace is going to be used.
func (PidMode) IsContainer ¶
IsContainer indicates whether the container uses a container's pid namespace.
type PidsStats ¶
type PidsStats struct {
// Current is the number of pids in the cgroup
Current uint64 `json:"current,omitempty"`
// Limit is the hard limit on the number of pids in the cgroup.
// A "Limit" of 0 means that there is no limit.
Limit uint64 `json:"limit,omitempty"`
}
PidsStats contains the stats of a container's pids
type PortSummary ¶
type PortSummary struct {
// Host IP address that the container's port is mapped to
IP netip.Addr `json:"IP,omitempty"`
// Port on the container
// Required: true
PrivatePort uint16 `json:"PrivatePort"`
// Port exposed on the host
PublicPort uint16 `json:"PublicPort,omitempty"`
// type
// Required: true
// Enum: ["tcp","udp","sctp"]
Type string `json:"Type"`
}
PortSummary Describes a port-mapping between the container and the host.
Example: {"PrivatePort":8080,"PublicPort":80,"Type":"tcp"}
swagger:model PortSummary
type PruneReport ¶
PruneReport contains the response for Engine API: POST "/containers/prune"
type Resources ¶
type Resources struct {
// Applicable to all platforms
Memory int64 // Memory limit (in bytes)
NanoCPUs int64 `json:"NanoCpus"` // CPU quota in units of 10<sup>-9</sup> CPUs.
// Applicable to UNIX platforms
CgroupParent string // Parent cgroup.
BlkioWeight uint16 // Block IO weight (relative weight vs. other containers)
BlkioWeightDevice []*blkiodev.WeightDevice
BlkioDeviceReadBps []*blkiodev.ThrottleDevice
BlkioDeviceWriteBps []*blkiodev.ThrottleDevice
BlkioDeviceReadIOps []*blkiodev.ThrottleDevice
BlkioDeviceWriteIOps []*blkiodev.ThrottleDevice
CPUPeriod int64 `json:"CpuPeriod"` // CPU CFS (Completely Fair Scheduler) period
CPUQuota int64 `json:"CpuQuota"` // CPU CFS (Completely Fair Scheduler) quota
CPURealtimePeriod int64 `json:"CpuRealtimePeriod"` // CPU real-time period
CPURealtimeRuntime int64 `json:"CpuRealtimeRuntime"` // CPU real-time runtime
CpusetCpus string // CpusetCpus 0-2, 0,1
CpusetMems string // CpusetMems 0-2, 0,1
Devices []DeviceMapping // List of devices to map inside the container
DeviceCgroupRules []string // List of rule to be added to the device cgroup
DeviceRequests []DeviceRequest // List of device requests for device drivers
MemoryReservation int64 // Memory soft limit (in bytes)
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap
MemorySwappiness *int64 // Tuning container memory swappiness behaviour
OomKillDisable *bool // Whether to disable OOM Killer or not
PidsLimit *int64 // Setting PIDs limit for a container; Set `0` or `-1` for unlimited, or `null` to not change.
Ulimits []*Ulimit // List of ulimits to be set in the container
// Applicable to Windows
CPUCount int64 `json:"CpuCount"` // CPU count
CPUPercent int64 `json:"CpuPercent"` // CPU percent
IOMaximumIOps uint64 // Maximum IOps for the container system drive
IOMaximumBandwidth uint64 // Maximum IO in bytes per second for the container system drive
}
Resources contains container's resources (cgroups config, ulimits...)
type RestartPolicy ¶
type RestartPolicy struct {
Name RestartPolicyMode
MaximumRetryCount int
}
RestartPolicy represents the restart policies of the container.
func (*RestartPolicy) IsAlways ¶
func (rp *RestartPolicy) IsAlways() bool
IsAlways indicates whether the container has the "always" restart policy. This means the container will automatically restart regardless of the exit status.
func (*RestartPolicy) IsNone ¶
func (rp *RestartPolicy) IsNone() bool
IsNone indicates whether the container has the "no" restart policy. This means the container will not automatically restart when exiting.
func (*RestartPolicy) IsOnFailure ¶
func (rp *RestartPolicy) IsOnFailure() bool
IsOnFailure indicates whether the container has the "on-failure" restart policy. This means the container will automatically restart of exiting with a non-zero exit status.
func (*RestartPolicy) IsSame ¶
func (rp *RestartPolicy) IsSame(tp *RestartPolicy) bool
IsSame compares two RestartPolicy to see if they are the same
func (*RestartPolicy) IsUnlessStopped ¶
func (rp *RestartPolicy) IsUnlessStopped() bool
IsUnlessStopped indicates whether the container has the "unless-stopped" restart policy. This means the container will automatically restart unless user has put it to stopped state.
type RestartPolicyMode ¶
type RestartPolicyMode string
const ( RestartPolicyDisabled RestartPolicyMode = "no" RestartPolicyAlways RestartPolicyMode = "always" RestartPolicyOnFailure RestartPolicyMode = "on-failure" RestartPolicyUnlessStopped RestartPolicyMode = "unless-stopped" )
type State ¶
type State struct {
Status ContainerState // String representation of the container state. Can be one of "created", "running", "paused", "restarting", "removing", "exited", or "dead"
Running bool
Paused bool
Restarting bool
OOMKilled bool
Dead bool
Pid int
ExitCode int
Error string
StartedAt string
FinishedAt string
Health *Health `json:",omitempty"`
}
State stores container's running state it's part of ContainerJSONBase and returned by "inspect" command
type StatsResponse ¶
type StatsResponse struct {
// ID is the ID of the container for which the stats were collected.
ID string `json:"id,omitempty"`
// Name is the name of the container for which the stats were collected.
Name string `json:"name,omitempty"`
// OSType is the OS of the container ("linux" or "windows") to allow
// platform-specific handling of stats.
OSType string `json:"os_type,omitempty"`
// Read is the date and time at which this sample was collected.
Read time.Time `json:"read"`
// CPUStats contains CPU related info of the container.
CPUStats CPUStats `json:"cpu_stats,omitempty"`
// MemoryStats aggregates all memory stats since container inception on Linux.
// Windows returns stats for commit and private working set only.
MemoryStats MemoryStats `json:"memory_stats,omitempty"`
// Networks contains Nntwork statistics for the container per interface.
//
// This field is omitted if the container has no networking enabled.
Networks map[string]NetworkStats `json:"networks,omitempty"`
// PidsStats contains Linux-specific stats of a container's process-IDs (PIDs).
//
// This field is Linux-specific and omitted for Windows containers.
PidsStats PidsStats `json:"pids_stats,omitempty"`
// BlkioStats stores all IO service stats for data read and write.
//
// This type is Linux-specific and holds many fields that are specific
// to cgroups v1.
//
// On a cgroup v2 host, all fields other than "io_service_bytes_recursive"
// are omitted or "null".
//
// This type is only populated on Linux and omitted for Windows containers.
BlkioStats BlkioStats `json:"blkio_stats,omitempty"`
// NumProcs is the number of processors on the system.
//
// This field is Windows-specific and always zero for Linux containers.
NumProcs uint32 `json:"num_procs"`
// StorageStats is the disk I/O stats for read/write on Windows.
//
// This type is Windows-specific and omitted for Linux containers.
StorageStats StorageStats `json:"storage_stats,omitempty"`
// PreRead is the date and time at which this first sample was collected.
// This field is not propagated if the "one-shot" option is set. If the
// "one-shot" option is set, this field may be omitted, empty, or set
// to a default date (`0001-01-01T00:00:00Z`).
PreRead time.Time `json:"preread"`
// PreCPUStats contains the CPUStats of the previous sample.
PreCPUStats CPUStats `json:"precpu_stats,omitempty"`
}
StatsResponse aggregates all types of stats of one container.
type StorageStats ¶
type StorageStats struct {
ReadCountNormalized uint64 `json:"read_count_normalized,omitempty"`
ReadSizeBytes uint64 `json:"read_size_bytes,omitempty"`
WriteCountNormalized uint64 `json:"write_count_normalized,omitempty"`
WriteSizeBytes uint64 `json:"write_size_bytes,omitempty"`
}
StorageStats is the disk I/O stats for read/write on Windows.
type Summary ¶
type Summary struct {
ID string `json:"Id"`
Names []string
Image string
ImageID string
ImageManifestDescriptor *ocispec.Descriptor `json:"ImageManifestDescriptor,omitempty"`
Command string
Created int64
Ports []PortSummary
SizeRw int64 `json:",omitempty"`
SizeRootFs int64 `json:",omitempty"`
Labels map[string]string
State ContainerState
Status string
HostConfig struct {
NetworkMode string `json:",omitempty"`
Annotations map[string]string `json:",omitempty"`
}
Health *HealthSummary `json:",omitempty"`
NetworkSettings *NetworkSettingsSummary
Mounts []MountPoint
}
Summary contains response of Engine API: GET "/containers/json"
type ThrottlingData ¶
type ThrottlingData struct {
// Number of periods with throttling active
Periods uint64 `json:"periods"`
// Number of periods when the container hits its throttling limit.
ThrottledPeriods uint64 `json:"throttled_periods"`
// Aggregate time the container was throttled for in nanoseconds.
ThrottledTime uint64 `json:"throttled_time"`
}
ThrottlingData stores CPU throttling stats of one running container. Not used on Windows.
type TopResponse ¶
type TopResponse struct {
// Each process running in the container, where each process
// is an array of values corresponding to the titles.
// Example: {"Processes":[["root","13642","882","0","17:03","pts/0","00:00:00","/bin/bash"],["root","13735","13642","0","17:06","pts/0","00:00:00","sleep 10"]]}
Processes [][]string `json:"Processes"`
// The ps column titles
// Example: {"Titles":["UID","PID","PPID","C","STIME","TTY","TIME","CMD"]}
Titles []string `json:"Titles"`
}
TopResponse ContainerTopResponse
Container "top" response.
swagger:model TopResponse
type UTSMode ¶
type UTSMode string
UTSMode represents the UTS namespace of the container.
type Ulimit ¶
Ulimit is an alias for units.Ulimit, which may be moving to a different location or become a local type. This alias is to help transitioning.
Users are recommended to use this alias instead of using units.Ulimit directly.
type UpdateConfig ¶
type UpdateConfig struct {
// Contains container's resources (cgroups, ulimits)
Resources
RestartPolicy RestartPolicy
}
UpdateConfig holds the mutable attributes of a Container. Those attributes can be updated at runtime.
type UpdateResponse ¶
type UpdateResponse struct {
// Warnings encountered when updating the container.
// Example: ["Published ports are discarded when using host network mode"]
Warnings []string `json:"Warnings"`
}
UpdateResponse ContainerUpdateResponse
Response for a successful container-update.
swagger:model UpdateResponse
type UsernsMode ¶
type UsernsMode string
UsernsMode represents userns mode in the container.
func (UsernsMode) IsHost ¶
func (n UsernsMode) IsHost() bool
IsHost indicates whether the container uses the host's userns.
func (UsernsMode) IsPrivate ¶
func (n UsernsMode) IsPrivate() bool
IsPrivate indicates whether the container uses the a private userns.
func (UsernsMode) Valid ¶
func (n UsernsMode) Valid() bool
Valid indicates whether the userns is valid.
type WaitCondition ¶
type WaitCondition string
WaitCondition is a type used to specify a container state for which to wait.
const ( WaitConditionNotRunning WaitCondition = "not-running" WaitConditionNextExit WaitCondition = "next-exit" WaitConditionRemoved WaitCondition = "removed" )
Possible WaitCondition Values.
WaitConditionNotRunning (default) is used to wait for any of the non-running states: "created", "exited", "dead", "removing", or "removed".
WaitConditionNextExit is used to wait for the next time the state changes to a non-running state. If the state is currently "created" or "exited", this would cause Wait() to block until either the container runs and exits or is removed.
WaitConditionRemoved is used to wait for the container to be removed.
type WaitExitError ¶
type WaitExitError struct {
// Details of an error
Message string `json:"Message,omitempty"`
}
WaitExitError container waiting error, if any
swagger:model WaitExitError
type WaitResponse ¶
type WaitResponse struct {
// error
Error *WaitExitError `json:"Error,omitempty"`
// Exit code of the container
// Required: true
StatusCode int64 `json:"StatusCode"`
}
WaitResponse ContainerWaitResponse
OK response to ContainerWait operation ¶
swagger:model WaitResponse
Source Files
¶
- change_type.go
- change_types.go
- commit.go
- config.go
- container.go
- create_request.go
- create_response.go
- disk_usage.go
- errors.go
- exec.go
- exec_create_request.go
- exec_start_request.go
- filesystem_change.go
- health.go
- hostconfig.go
- hostconfig_unix.go
- network_settings.go
- port_summary.go
- state.go
- stats.go
- top_response.go
- update_response.go
- wait_exit_error.go
- wait_response.go
- waitcondition.go