Documentation ¶
Index ¶
- type CgroupSpec
- type Config
- type DeviceMapping
- type HostConfig
- type IpcMode
- type Isolation
- type LogConfig
- type NetworkMode
- func (n NetworkMode) ConnectedContainer() 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 PidMode
- type Resources
- type RestartPolicy
- type UTSMode
- type UpdateConfig
- type UsernsMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CgroupSpec ¶ added in v0.3.0
type CgroupSpec string
Cgroup Spec represents the cgroup to use for the container.
func (CgroupSpec) Container ¶ added in v0.3.0
func (c CgroupSpec) Container() string
Container returns the name of the container whose cgroup will be used.
func (CgroupSpec) IsContainer ¶ added in v0.3.0
func (c CgroupSpec) IsContainer() bool
func (CgroupSpec) Valid ¶ added in v0.3.0
func (c CgroupSpec) Valid() bool
type Config ¶
type Config struct { Hostname string // Hostname Domainname string // Domainname User string // User that will run the command(s) inside the container AttachStdin bool // Attach the standard input, makes possible user interaction AttachStdout bool // Attach the standard output AttachStderr bool // Attach the standard error ExposedPorts map[nat.Port]struct{} `json:",omitempty"` // List of exposed ports PublishService string `json:",omitempty"` // Name of the network service exposed by the container 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 strslice.StrSlice // Command to run when starting the container ArgsEscaped bool `json:",omitempty"` // True if command is already escaped (Windows specific) Image string // Name of the image as it was passed by the operator (eg. 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 strslice.StrSlice // Entrypoint to run when starting the container NetworkDisabled bool `json:",omitempty"` // Is network disabled MacAddress string `json:",omitempty"` // Mac Address of the container OnBuild []string // 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 }
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 DeviceMapping ¶
DeviceMapping represents the device mapping between the host and the container.
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 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 VolumeDriver string // Name of the volume driver used to mount volumes VolumesFrom []string // List of volumes to take from other container // Applicable to UNIX platforms CapAdd strslice.StrSlice // List of kernel capabilities to add to the container CapDrop strslice.StrSlice // List of kernel capabilities to remove from 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 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 // 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 // Applicable to Windows ConsoleSize [2]int // Initial console size Isolation Isolation // Isolation technology of the container (eg default, hyperv) // Contains container's resources (cgroups, ulimits) Resources }
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 IpcMode ¶
type IpcMode string
IpcMode represents the container ipc stack.
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 a container's ipc stack.
type Isolation ¶ added in v0.3.0
type Isolation string
Isolation represents the isolation technology of a container. The supported values are platform specific
type NetworkMode ¶
type NetworkMode string
NetworkMode represents the container network stack.
func (NetworkMode) ConnectedContainer ¶
func (n NetworkMode) ConnectedContainer() 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 it's 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 PidMode ¶
type PidMode string
PidMode represents the pid stack of the container.
type Resources ¶
type Resources struct { // Applicable to all platforms Memory int64 // Memory limit (in bytes) // 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 CpusetCpus string // CpusetCpus 0-2, 0,1 CpusetMems string // CpusetMems 0-2, 0,1 Devices []DeviceMapping // List of devices to map inside the container DiskQuota int64 // Disk limit (in bytes) KernelMemory int64 // Kernel memory limit (in bytes) 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 Ulimits []*units.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 BlkioIOps uint64 // Maximum IOps for the container system drive BlkioBps uint64 // Maximum Bytes per second for the container system drive SandboxSize uint64 // System drive will be expanded to at least this size (in bytes) }
Resources contains container's resources (cgroups config, ulimits...)
type RestartPolicy ¶
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 contain will automatically restart of exiting with a non-zero exit status.
func (*RestartPolicy) IsSame ¶ added in v0.3.0
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 UTSMode ¶
type UTSMode string
UTSMode represents the UTS namespace of the container.
type UpdateConfig ¶ added in v0.1.2
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 UsernsMode ¶ added in v0.3.0
type UsernsMode string
UsernsMode represents userns mode in the container.
func (UsernsMode) IsHost ¶ added in v0.3.0
func (n UsernsMode) IsHost() bool
IsHost indicates whether the container uses the host's userns.
func (UsernsMode) IsPrivate ¶ added in v0.3.0
func (n UsernsMode) IsPrivate() bool
IsPrivate indicates whether the container uses the a private userns.
func (UsernsMode) Valid ¶ added in v0.3.0
func (n UsernsMode) Valid() bool
Valid indicates whether the userns is valid.