Movatterモバイル変換


[0]ホーム

URL:


container

package
v1.52.0Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License:Apache-2.0Imports:14Imported by:103

Details

Repository

github.com/moby/moby

Links

Documentation

Index

Constants

View Source
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 mayset 3 as healthcheck interval with intention of 3 seconds, butDocker interprets it as 3 nanoseconds.

Variables

This section is empty.

Functions

funcValidateContainerState

func ValidateContainerState(sContainerState)error

ValidateContainerState checks if the provided string is a validcontainerContainerState.

funcValidateHealthStatus

func ValidateHealthStatus(sHealthStatus)error

ValidateHealthStatus checks if the provided string is a validcontainerHealthStatus.

funcValidateRestartPolicy

func ValidateRestartPolicy(policyRestartPolicy)error

ValidateRestartPolicy validates the given RestartPolicy.

Types

typeBlkioStatEntry

type BlkioStatEntry struct {Majoruint64 `json:"major"`Minoruint64 `json:"minor"`Opstring `json:"op"`Valueuint64 `json:"value"`}

BlkioStatEntry is one small entity to store a piece of Blkio statsNot used on Windows.

typeBlkioStats

type BlkioStats struct {// number of bytes transferred to and from the block deviceIoServiceBytesRecursive []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 expressingblock I/O on Windows and Linux are sufficiently significant to makelittle sense attempting to morph into a combined structure.

typeCPUStats

type CPUStats struct {// CPU Usage. Linux and Windows.CPUUsageCPUUsage `json:"cpu_usage"`// System Usage. Linux only.SystemUsageuint64 `json:"system_cpu_usage,omitempty"`// Online CPUs. Linux only.OnlineCPUsuint32 `json:"online_cpus,omitempty"`// Throttling Data. Linux only.ThrottlingDataThrottlingData `json:"throttling_data,omitempty"`}

CPUStats aggregates and wraps all CPU related info of container

typeCPUUsage

type CPUUsage struct {// Total CPU time consumed.// Units: nanoseconds (Linux)// Units: 100's of nanoseconds (Windows)TotalUsageuint64 `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.UsageInKernelmodeuint64 `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 ContainersUsageInUsermodeuint64 `json:"usage_in_usermode"`}

CPUUsage stores All CPU stats aggregated since container inception.

typeCgroupSpec

type CgroupSpecstring

CgroupSpec represents the cgroup to use for the container.

func (CgroupSpec)Container

func (cCgroupSpec) Container() (idOrNamestring)

Container returns the ID or name of the container whose cgroup will be used.

func (CgroupSpec)IsContainer

func (cCgroupSpec) IsContainer()bool

IsContainer indicates whether the container is using another container cgroup

func (CgroupSpec)Valid

func (cCgroupSpec) Valid()bool

Valid indicates whether the cgroup spec is valid.

typeCgroupnsMode

type CgroupnsModestring

CgroupnsMode represents the cgroup namespace mode of the container

const (CgroupnsModeEmptyCgroupnsMode = ""CgroupnsModePrivateCgroupnsMode = "private"CgroupnsModeHostCgroupnsMode = "host")

cgroup namespace modes for containers

func (CgroupnsMode)IsEmpty

func (cCgroupnsMode) IsEmpty()bool

IsEmpty indicates whether the container cgroup namespace mode is unset

func (CgroupnsMode)IsHost

func (cCgroupnsMode) IsHost()bool

IsHost indicates whether the container shares the host's cgroup namespace

func (CgroupnsMode)IsPrivate

func (cCgroupnsMode) IsPrivate()bool

IsPrivate indicates whether the container uses its own private cgroup namespace

func (CgroupnsMode)Valid

func (cCgroupnsMode) Valid()bool

Valid indicates whether the cgroup namespace mode is valid

typeChangeType

type ChangeTypeuint8

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.ChangeModifyChangeType = 0// ChangeAdd represents the add operation.ChangeAddChangeType = 1// ChangeDelete represents the delete operation.ChangeDeleteChangeType = 2)

func (ChangeType)String

func (ctChangeType) String()string

typeCommitResponse

type CommitResponse =common.IDResponse

CommitResponse response for the commit API call, containing the ID of theimage that was produced.

typeConfig

type Config struct {Hostnamestring// HostnameDomainnamestring// DomainnameUserstring// User that will run the command(s) inside the container, also support user:groupAttachStdinbool// Attach the standard input, makes possible user interactionAttachStdoutbool// Attach the standard outputAttachStderrbool// Attach the standard errorExposedPortsnetwork.PortSet     `json:",omitempty"`// List of exposed portsTtybool// Attach standard streams to a tty, including stdin if it is not closed.OpenStdinbool// Open stdinStdinOncebool// If true, close stdin after the 1 attached client disconnects.Env             []string// List of environment variable to set in the containerCmd             []string// Command to run when starting the containerHealthcheck     *HealthConfig       `json:",omitempty"`// Healthcheck describes how to check the container is healthyArgsEscapedbool                `json:",omitempty"`// True if command is already escaped (meaning treat as a command line) (Windows specific).Imagestring// 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 containerWorkingDirstring// Current directory (PWD) in the command will be launchedEntrypoint      []string// Entrypoint to run when starting the containerNetworkDisabledbool                `json:",omitempty"`// Is network disabledOnBuild         []string            `json:",omitempty"`// ONBUILD metadata that were defined on the image DockerfileLabels          map[string]string// List of labels set to this containerStopSignalstring              `json:",omitempty"`// Signal to stop a containerStopTimeout     *int                `json:",omitempty"`// Timeout (in seconds) to stop a containerShell           []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 gettingpredictable hashes from the old `v1Compatibility` configuration.

typeContainerState

type ContainerStatestring

ContainerState is a string representation of the container's current state.

const (StateCreatedContainerState = "created"// StateCreated indicates the container is created, but not (yet) started.StateRunningContainerState = "running"// StateRunning indicates that the container is running.StatePausedContainerState = "paused"// StatePaused indicates that the container's current state is paused.StateRestartingContainerState = "restarting"// StateRestarting indicates that the container is currently restarting.StateRemovingContainerState = "removing"// StateRemoving indicates that the container is being removed.StateExitedContainerState = "exited"// StateExited indicates that the container exited.StateDeadContainerState = "dead"// StateDead indicates that the container failed to be deleted. Containers in this state are attempted to be cleaned up when the daemon restarts.)

typeCreateRequest

type CreateRequest struct {*ConfigHostConfig       *HostConfig               `json:"HostConfig,omitempty"`NetworkingConfig *network.NetworkingConfig `json:"NetworkingConfig,omitempty"`}

CreateRequest is the request message sent to the server for containercreate calls. It is a config wrapper that holds the containerConfig(portable) and the correspondingHostConfig (non-portable) andnetwork.NetworkingConfig.

typeCreateResponse

type CreateResponse struct {// The ID of the created container// Example: ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743// Required: trueIDstring `json:"Id"`// Warnings encountered when creating the container// Example: []// Required: trueWarnings []string `json:"Warnings"`}

CreateResponse ContainerCreateResponse

OK response to ContainerCreate operation

swagger:model CreateResponse

typeDeviceMapping

type DeviceMapping struct {PathOnHoststringPathInContainerstringCgroupPermissionsstring}

DeviceMapping represents the device mapping between the host and the container.

typeDeviceRequest

type DeviceRequest struct {Driverstring// Name of device driverCountint// Number of devices to request (-1 = All)DeviceIDs    []string// List of device IDs as recognizable by the device driverCapabilities [][]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.

typeDiskUsage

type DiskUsage struct {// Count of active containers.//// Example: 1ActiveCountint64 `json:"ActiveCount,omitempty"`// List of container summaries.//Items []Summary `json:"Items,omitempty"`// Disk space that can be reclaimed by removing inactive containers.//// Example: 12345678Reclaimableint64 `json:"Reclaimable,omitempty"`// Count of all containers.//// Example: 4TotalCountint64 `json:"TotalCount,omitempty"`// Disk space in use by containers.//// Example: 98765432TotalSizeint64 `json:"TotalSize,omitempty"`}

DiskUsage represents system data usage information for container resources.

swagger:model DiskUsage

typeExecCreateRequest

type ExecCreateRequest struct {Userstring// User that will run the commandPrivilegedbool// Is the container in privileged modeTtybool// Attach standard streams to a tty.ConsoleSize  *[2]uint `json:",omitempty"`// Initial console size [height, width]AttachStdinbool// Attach the standard input, makes possible user interactionAttachStderrbool// Attach the standard errorAttachStdoutbool// Attach the standard outputDetachKeysstring// Escape keys for detachEnv          []string// Environment variablesWorkingDirstring// Working directoryCmd          []string// Execution commands and args}

ExecCreateRequest is a small subset of the Config struct that holds the configurationfor the exec feature of docker.

typeExecCreateResponse

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.

typeExecInspectResponse

type ExecInspectResponse struct {IDstring `json:"ID"`Runningbool   `json:"Running"`ExitCode      *int   `json:"ExitCode"`ProcessConfig *ExecProcessConfigOpenStdinbool   `json:"OpenStdin"`OpenStderrbool   `json:"OpenStderr"`OpenStdoutbool   `json:"OpenStdout"`CanRemovebool   `json:"CanRemove"`ContainerIDstring `json:"ContainerID"`DetachKeys    []byte `json:"DetachKeys"`Pidint    `json:"Pid"`}

ExecInspectResponse is the API response for the "GET /exec/{id}/json"endpoint and holds information about and exec.

typeExecProcessConfig

type ExecProcessConfig struct {Ttybool     `json:"tty"`Entrypointstring   `json:"entrypoint"`Arguments  []string `json:"arguments"`Privileged *bool    `json:"privileged,omitempty"`Userstring   `json:"user,omitempty"`}

ExecProcessConfig holds information about the exec processrunning on the host.

typeExecStartRequest

type ExecStartRequest struct {// ExecStart will first check if it's detachedDetachbool// Check if there's a ttyTtybool// Terminal size [height, width], unused if Tty == falseConsoleSize *[2]uint `json:",omitempty"`}

ExecStartRequest is a temp struct used by execStartConfig fields is part of ExecConfig in runconfig package

typeFilesystemChange

type FilesystemChange struct {// kind// Required: trueKindChangeType `json:"Kind"`// Path to file or directory that has changed.//// Required: truePathstring `json:"Path"`}

FilesystemChange Change in the container's filesystem.

swagger:model FilesystemChange

typeHealth

type Health struct {StatusHealthStatus// Status is one of [Starting], [Healthy] or [Unhealthy].FailingStreakint// FailingStreak is the number of consecutive failuresLog           []*HealthcheckResult// Log contains the last few results (oldest first)}

Health stores information about the container's healthcheck results

typeHealthConfig

type HealthConfig =dockerspec.HealthcheckConfig

HealthConfig holds configuration settings for the HEALTHCHECK feature.

typeHealthStatus

type HealthStatusstring

HealthStatus is a string representation of the container's health.

const (NoHealthcheckHealthStatus = "none"// Indicates there is no healthcheckStartingHealthStatus = "starting"// Starting indicates that the container is not yet readyHealthyHealthStatus = "healthy"// Healthy indicates that the container is running correctlyUnhealthyHealthStatus = "unhealthy"// Unhealthy indicates that the container has a problem)

Health states

typeHealthSummary

type HealthSummary struct {StatusHealthStatus// Status is one of [NoHealthcheck], [Starting], [Healthy] or [Unhealthy].FailingStreakint// FailingStreak is the number of consecutive failures}

HealthSummary stores a summary of the container's healthcheck results.

typeHealthcheckResult

type HealthcheckResult struct {Starttime.Time// Start is the time this check startedEndtime.Time// End is the time this check endedExitCodeint// ExitCode meanings: 0=healthy, 1=unhealthy, 2=reserved (considered unhealthy), else=error running probeOutputstring// Output from last check}

HealthcheckResult stores information about a single run of a healthcheck probe

typeHostConfig

type HostConfig struct {// Applicable to all platformsBinds           []string// List of volume bindings for this containerContainerIDFilestring// File (path) where the containerId is writtenLogConfigLogConfig// Configuration of the logs for this containerNetworkModeNetworkMode// Network mode to use for the containerPortBindingsnetwork.PortMap// Port mapping between the exposed port (container) and the hostRestartPolicyRestartPolicy// Restart policy to be used for the containerAutoRemovebool// Automatically remove container when it exitsVolumeDriverstring// Name of the volume driver used to mount volumesVolumesFrom     []string// List of volumes to take from other containerConsoleSize     [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 platformsCapAdd          []string// List of kernel capabilities to add to the containerCapDrop         []string// List of kernel capabilities to remove from the containerCgroupnsModeCgroupnsMode// Cgroup namespace mode to use for the containerDNS             []netip.Addr      `json:"Dns"`// List of DNS server to lookupDNSOptions      []string          `json:"DnsOptions"`// List of DNSOption to look forDNSSearch       []string          `json:"DnsSearch"`// List of DNSSearch to look forExtraHosts      []string// List of extra hostsGroupAdd        []string// List of additional groups that the container process will run asIpcModeIpcMode// IPC namespace to use for the containerCgroupCgroupSpec// Cgroup to use for the containerLinks           []string// List of links (in the name:alias form)OomScoreAdjint// Container preference for OOM-killingPidModePidMode// PID namespace to use for the containerPrivilegedbool// Is the container in privileged modePublishAllPortsbool// Should docker publish all exposed port for the containerReadonlyRootfsbool// Is the container root filesystem in read-onlySecurityOpt     []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 containerUTSModeUTSMode// UTS namespace to use for the containerUsernsModeUsernsMode// The user namespace to use for the containerShmSizeint64// Total shm memory usageSysctls         map[string]string `json:",omitempty"`// List of Namespaced sysctls used for the containerRuntimestring            `json:",omitempty"`// Runtime to use with this container// Applicable to WindowsIsolationIsolation// Isolation technology of the container (e.g. default, hyperv)// Contains container's resources (cgroups, ulimits)Resources// Mounts specs used by the containerMounts []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 settingsInit *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.

typeInspectResponse

type InspectResponse struct {IDstring `json:"Id"`CreatedstringPathstringArgs            []stringState           *StateImagestringResolvConfPathstringHostnamePathstringHostsPathstringLogPathstringNamestringRestartCountintDriverstringPlatformstringMountLabelstringProcessLabelstringAppArmorProfilestringExecIDs         []stringHostConfig      *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          []MountPointConfig          *ConfigNetworkSettings *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.

typeIpcMode

type IpcModestring

IpcMode represents the container ipc stack.

const (IPCModeNoneIpcMode = "none"IPCModeHostIpcMode = "host"IPCModeContainerIpcMode = "container"IPCModePrivateIpcMode = "private"IPCModeShareableIpcMode = "shareable")

IpcMode constants

func (IpcMode)Container

func (nIpcMode) Container() (idOrNamestring)

Container returns the name of the container ipc stack is going to be used.

func (IpcMode)IsContainer

func (nIpcMode) IsContainer()bool

IsContainer indicates whether the container uses another container's ipc namespace.

func (IpcMode)IsEmpty

func (nIpcMode) IsEmpty()bool

IsEmpty indicates whether container IpcMode is empty

func (IpcMode)IsHost

func (nIpcMode) IsHost()bool

IsHost indicates whether the container shares the host's ipc namespace.

func (IpcMode)IsNone

func (nIpcMode) IsNone()bool

IsNone indicates whether container IpcMode is set to "none".

func (IpcMode)IsPrivate

func (nIpcMode) IsPrivate()bool

IsPrivate indicates whether the container uses its own private ipc namespace which can not be shared.

func (IpcMode)IsShareable

func (nIpcMode) IsShareable()bool

IsShareable indicates whether the container's ipc namespace can be shared with another container.

func (IpcMode)Valid

func (nIpcMode) Valid()bool

Valid indicates whether the ipc mode is valid.

typeIsolation

type Isolationstring

Isolation represents the isolation technology of a container. The supportedvalues are platform specific

const (IsolationEmptyIsolation = ""// IsolationEmpty is unspecified (same behavior as default)IsolationDefaultIsolation = "default"// IsolationDefault is the default isolation mode on current daemonIsolationProcessIsolation = "process"// IsolationProcess is process isolation modeIsolationHyperVIsolation = "hyperv"// IsolationHyperV is HyperV isolation mode)

Isolation modes for containers

func (Isolation)IsDefault

func (iIsolation) IsDefault()bool

IsDefault indicates the default isolation technology of a container. On Linux thisis the native driver. On Windows, this is a Windows Server Container.

func (Isolation)IsHyperV

func (iIsolation) IsHyperV()bool

IsHyperV indicates the use of a Hyper-V partition for isolation

func (Isolation)IsProcess

func (iIsolation) IsProcess()bool

IsProcess indicates the use of process isolation

func (Isolation)IsValid

func (iIsolation) IsValid()bool

IsValid indicates if an isolation technology is valid

typeLogConfig

type LogConfig struct {TypestringConfig map[string]string}

LogConfig represents the logging configuration of the container.

typeLogMode

type LogModestring

LogMode is a type to define the available modes for loggingThese modes affect how logs are handled when log messages start piling up.

const (LogModeUnsetLogMode = ""LogModeBlockingLogMode = "blocking"LogModeNonBlockLogMode = "non-blocking")

Available logging modes

typeMemoryStats

type MemoryStats struct {// current res_counter usage for memoryUsageuint64 `json:"usage,omitempty"`// maximum usage ever recorded.MaxUsageuint64 `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.Failcntuint64 `json:"failcnt,omitempty"`Limituint64 `json:"limit,omitempty"`// committed bytesCommituint64 `json:"commitbytes,omitempty"`// peak committed bytesCommitPeakuint64 `json:"commitpeakbytes,omitempty"`// private working setPrivateWorkingSetuint64 `json:"privateworkingset,omitempty"`}

MemoryStats aggregates all memory stats since container inception on Linux.Windows returns stats for commit and private working set only.

typeMountPoint

type MountPoint struct {// Type is the type of mount, see [mount.Type] definitions for details.Typemount.Type `json:",omitempty"`// Name is the name reference to the underlying data defined by `Source`// e.g., the volume name.Namestring `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.Sourcestring// Destination is the path relative to the container root (`/`) where the// Source is mounted inside the container.Destinationstring// Driver is the volume driver used to create the volume (if it is a volume).Driverstring `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).Modestring// RW indicates whether the mount is mounted writable (read-write).RWbool// 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.Propagationmount.Propagation}

MountPoint represents a mount point configuration inside the container.This is used for reporting the mountpoints in use by a container.

typeNetworkMode

type NetworkModestring

NetworkMode represents the container network stack.

func (NetworkMode)ConnectedContainer

func (nNetworkMode) ConnectedContainer() (idOrNamestring)

ConnectedContainer is the id of the container which network this container is connected to.

func (NetworkMode)IsBridge

func (nNetworkMode) IsBridge()bool

IsBridge indicates whether container uses the bridge network stack

func (NetworkMode)IsContainer

func (nNetworkMode) IsContainer()bool

IsContainer indicates whether container uses a container network stack.

func (NetworkMode)IsDefault

func (nNetworkMode) IsDefault()bool

IsDefault indicates whether container uses the default network stack.

func (NetworkMode)IsHost

func (nNetworkMode) IsHost()bool

IsHost indicates whether container uses the host network stack.

func (NetworkMode)IsNone

func (nNetworkMode) IsNone()bool

IsNone indicates whether container isn't using a network stack.

func (NetworkMode)IsPrivate

func (nNetworkMode) IsPrivate()bool

IsPrivate indicates whether container uses its private network stack.

func (NetworkMode)IsUserDefined

func (nNetworkMode) IsUserDefined()bool

IsUserDefined indicates user-created network

func (NetworkMode)NetworkName

func (nNetworkMode) NetworkName()string

NetworkName returns the name of the network stack.

func (NetworkMode)UserDefined

func (nNetworkMode) UserDefined()string

UserDefined indicates user-created network

typeNetworkSettings

type NetworkSettings struct {SandboxIDstring// SandboxID uniquely represents a container's network stackSandboxKeystring// SandboxKey identifies the sandbox// Ports is a collection of [network.PortBinding] indexed by [network.Port]Portsnetwork.PortMapNetworks map[string]*network.EndpointSettings}

NetworkSettings exposes the network settings in the api

typeNetworkSettingsSummary

type NetworkSettingsSummary struct {Networks map[string]*network.EndpointSettings}

NetworkSettingsSummary provides a summary of container's networksin /containers/json

typeNetworkStats

type NetworkStats struct {// Bytes received. Windows and Linux.RxBytesuint64 `json:"rx_bytes"`// Packets received. Windows and Linux.RxPacketsuint64 `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.RxErrorsuint64 `json:"rx_errors"`// Incoming packets dropped. Windows and Linux.RxDroppeduint64 `json:"rx_dropped"`// Bytes sent. Windows and Linux.TxBytesuint64 `json:"tx_bytes"`// Packets sent. Windows and Linux.TxPacketsuint64 `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.TxErrorsuint64 `json:"tx_errors"`// Outgoing packets dropped. Windows and Linux.TxDroppeduint64 `json:"tx_dropped"`// Endpoint ID. Not used on Linux.EndpointIDstring `json:"endpoint_id,omitempty"`// Instance ID. Not used on Linux.InstanceIDstring `json:"instance_id,omitempty"`}

NetworkStats aggregates the network stats of one container

typePathStat

type PathStat struct {Namestring      `json:"name"`Sizeint64       `json:"size"`Modeos.FileMode `json:"mode"`Mtimetime.Time   `json:"mtime"`LinkTargetstring      `json:"linkTarget"`}

PathStat is used to encode the header fromGET "/containers/{name:.*}/archive""Name" is the file or directory name.

typePidMode

type PidModestring

PidMode represents the pid namespace of the container.

func (PidMode)Container

func (nPidMode) Container() (idOrNamestring)

Container returns the name of the container whose pid namespace is going to be used.

func (PidMode)IsContainer

func (nPidMode) IsContainer()bool

IsContainer indicates whether the container uses a container's pid namespace.

func (PidMode)IsHost

func (nPidMode) IsHost()bool

IsHost indicates whether the container uses the host's pid namespace.

func (PidMode)IsPrivate

func (nPidMode) IsPrivate()bool

IsPrivate indicates whether the container uses its own new pid namespace.

func (PidMode)Valid

func (nPidMode) Valid()bool

Valid indicates whether the pid namespace is valid.

typePidsStats

type PidsStats struct {// Current is the number of pids in the cgroupCurrentuint64 `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.Limituint64 `json:"limit,omitempty"`}

PidsStats contains the stats of a container's pids

typePortSummary

type PortSummary struct {// Host IP address that the container's port is mapped toIPnetip.Addr `json:"IP,omitempty"`// Port on the container// Required: truePrivatePortuint16 `json:"PrivatePort"`// Port exposed on the hostPublicPortuint16 `json:"PublicPort,omitempty"`// type// Required: true// Enum: ["tcp","udp","sctp"]Typestring `json:"Type"`}

PortSummary Describes a port-mapping between the container and the host.

Example: {"PrivatePort":8080,"PublicPort":80,"Type":"tcp"}

swagger:model PortSummary

typePruneReport

type PruneReport struct {ContainersDeleted []stringSpaceReclaimeduint64}

PruneReport contains the response for Engine API:POST "/containers/prune"

typeResources

type Resources struct {// Applicable to all platformsCPUSharesint64 `json:"CpuShares"`// CPU shares (relative weight vs. other containers)Memoryint64// Memory limit (in bytes)NanoCPUsint64 `json:"NanoCpus"`// CPU quota in units of 10<sup>-9</sup> CPUs.// Applicable to UNIX platformsCgroupParentstring// Parent cgroup.BlkioWeightuint16// Block IO weight (relative weight vs. other containers)BlkioWeightDevice    []*blkiodev.WeightDeviceBlkioDeviceReadBps   []*blkiodev.ThrottleDeviceBlkioDeviceWriteBps  []*blkiodev.ThrottleDeviceBlkioDeviceReadIOps  []*blkiodev.ThrottleDeviceBlkioDeviceWriteIOps []*blkiodev.ThrottleDeviceCPUPeriodint64           `json:"CpuPeriod"`// CPU CFS (Completely Fair Scheduler) periodCPUQuotaint64           `json:"CpuQuota"`// CPU CFS (Completely Fair Scheduler) quotaCPURealtimePeriodint64           `json:"CpuRealtimePeriod"`// CPU real-time periodCPURealtimeRuntimeint64           `json:"CpuRealtimeRuntime"`// CPU real-time runtimeCpusetCpusstring// CpusetCpus 0-2, 0,1CpusetMemsstring// CpusetMems 0-2, 0,1Devices              []DeviceMapping// List of devices to map inside the containerDeviceCgroupRules    []string// List of rule to be added to the device cgroupDeviceRequests       []DeviceRequest// List of device requests for device driversMemoryReservationint64// Memory soft limit (in bytes)MemorySwapint64// Total memory usage (memory + swap); set `-1` to enable unlimited swapMemorySwappiness     *int64// Tuning container memory swappiness behaviourOomKillDisable       *bool// Whether to disable OOM Killer or notPidsLimit            *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 WindowsCPUCountint64  `json:"CpuCount"`// CPU countCPUPercentint64  `json:"CpuPercent"`// CPU percentIOMaximumIOpsuint64// Maximum IOps for the container system driveIOMaximumBandwidthuint64// Maximum IO in bytes per second for the container system drive}

Resources contains container's resources (cgroups config, ulimits...)

typeRestartPolicy

type RestartPolicy struct {NameRestartPolicyModeMaximumRetryCountint}

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 willautomatically restart unless user has put it to stopped state.

typeRestartPolicyMode

type RestartPolicyModestring
const (RestartPolicyDisabledRestartPolicyMode = "no"RestartPolicyAlwaysRestartPolicyMode = "always"RestartPolicyOnFailureRestartPolicyMode = "on-failure"RestartPolicyUnlessStoppedRestartPolicyMode = "unless-stopped")

typeState

type State struct {StatusContainerState// String representation of the container state. Can be one of "created", "running", "paused", "restarting", "removing", "exited", or "dead"RunningboolPausedboolRestartingboolOOMKilledboolDeadboolPidintExitCodeintErrorstringStartedAtstringFinishedAtstringHealth     *Health `json:",omitempty"`}

State stores container's running stateit's part of ContainerJSONBase and returned by "inspect" command

typeStatsResponse

type StatsResponse struct {// ID is the ID of the container for which the stats were collected.IDstring `json:"id,omitempty"`// Name is the name of the container for which the stats were collected.Namestring `json:"name,omitempty"`// OSType is the OS of the container ("linux" or "windows") to allow// platform-specific handling of stats.OSTypestring `json:"os_type,omitempty"`// Read is the date and time at which this sample was collected.Readtime.Time `json:"read"`// CPUStats contains CPU related info of the container.CPUStatsCPUStats `json:"cpu_stats,omitempty"`// MemoryStats aggregates all memory stats since container inception on Linux.// Windows returns stats for commit and private working set only.MemoryStatsMemoryStats `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.PidsStatsPidsStats `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.BlkioStatsBlkioStats `json:"blkio_stats,omitempty"`// NumProcs is the number of processors on the system.//// This field is Windows-specific and always zero for Linux containers.NumProcsuint32 `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.StorageStatsStorageStats `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`).PreReadtime.Time `json:"preread"`// PreCPUStats contains the CPUStats of the previous sample.PreCPUStatsCPUStats `json:"precpu_stats,omitempty"`}

StatsResponse aggregates all types of stats of one container.

typeStorageStats

type StorageStats struct {ReadCountNormalizeduint64 `json:"read_count_normalized,omitempty"`ReadSizeBytesuint64 `json:"read_size_bytes,omitempty"`WriteCountNormalizeduint64 `json:"write_count_normalized,omitempty"`WriteSizeBytesuint64 `json:"write_size_bytes,omitempty"`}

StorageStats is the disk I/O stats for read/write on Windows.

typeSummary

type Summary struct {IDstring `json:"Id"`Names                   []stringImagestringImageIDstringImageManifestDescriptor *ocispec.Descriptor `json:"ImageManifestDescriptor,omitempty"`CommandstringCreatedint64Ports                   []PortSummarySizeRwint64 `json:",omitempty"`SizeRootFsint64 `json:",omitempty"`Labels                  map[string]stringStateContainerStateStatusstringHostConfig              struct {NetworkModestring            `json:",omitempty"`Annotations map[string]string `json:",omitempty"`}Health          *HealthSummary `json:",omitempty"`NetworkSettings *NetworkSettingsSummaryMounts          []MountPoint}

Summary contains response of Engine API:GET "/containers/json"

typeThrottlingData

type ThrottlingData struct {// Number of periods with throttling activePeriodsuint64 `json:"periods"`// Number of periods when the container hits its throttling limit.ThrottledPeriodsuint64 `json:"throttled_periods"`// Aggregate time the container was throttled for in nanoseconds.ThrottledTimeuint64 `json:"throttled_time"`}

ThrottlingData stores CPU throttling stats of one running container.Not used on Windows.

typeTopResponse

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

typeUTSMode

type UTSModestring

UTSMode represents the UTS namespace of the container.

func (UTSMode)IsHost

func (nUTSMode) IsHost()bool

IsHost indicates whether the container uses the host's UTS namespace.

func (UTSMode)IsPrivate

func (nUTSMode) IsPrivate()bool

IsPrivate indicates whether the container uses its private UTS namespace.

func (UTSMode)Valid

func (nUTSMode) Valid()bool

Valid indicates whether the UTS namespace is valid.

typeUlimit

type Ulimit = units.Ulimit

Ulimit is an alias forunits.Ulimit, which may be moving to a differentlocation or become a local type. This alias is to help transitioning.

Users are recommended to use this alias instead of usingunits.Ulimit directly.

typeUpdateConfig

type UpdateConfig struct {// Contains container's resources (cgroups, ulimits)ResourcesRestartPolicyRestartPolicy}

UpdateConfig holds the mutable attributes of a Container.Those attributes can be updated at runtime.

typeUpdateResponse

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

typeUsernsMode

type UsernsModestring

UsernsMode represents userns mode in the container.

func (UsernsMode)IsHost

func (nUsernsMode) IsHost()bool

IsHost indicates whether the container uses the host's userns.

func (UsernsMode)IsPrivate

func (nUsernsMode) IsPrivate()bool

IsPrivate indicates whether the container uses the a private userns.

func (UsernsMode)Valid

func (nUsernsMode) Valid()bool

Valid indicates whether the userns is valid.

typeWaitCondition

type WaitConditionstring

WaitCondition is a type used to specify a container state for whichto wait.

const (WaitConditionNotRunningWaitCondition = "not-running"WaitConditionNextExitWaitCondition = "next-exit"WaitConditionRemovedWaitCondition = "removed")

Possible WaitCondition Values.

WaitConditionNotRunning (default) is used to wait for any of the non-runningstates: "created", "exited", "dead", "removing", or "removed".

WaitConditionNextExit is used to wait for the next time the state changesto a non-running state. If the state is currently "created" or "exited",this would cause Wait() to block until either the container runs and exitsor is removed.

WaitConditionRemoved is used to wait for the container to be removed.

typeWaitExitError

type WaitExitError struct {// Details of an errorMessagestring `json:"Message,omitempty"`}

WaitExitError container waiting error, if any

swagger:model WaitExitError

typeWaitResponse

type WaitResponse struct {// errorError *WaitExitError `json:"Error,omitempty"`// Exit code of the container// Required: trueStatusCodeint64 `json:"StatusCode"`}

WaitResponse ContainerWaitResponse

OK response to ContainerWait operation

swagger:model WaitResponse

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp