Documentation
¶
Index ¶
- Variables
- func Compare(a, b *Config) bool
- func DecodeContainerConfig(src io.Reader) (*Config, *HostConfig, error)
- func Merge(userConf, imageConf *Config) error
- func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSet, error)
- type Command
- type Config
- type ContainerConfigWrapper
- type DeviceMapping
- type Entrypoint
- type ExecConfig
- type HostConfig
- type IpcMode
- type KeyValuePair
- type LogConfig
- type LxcConfig
- type NetworkMode
- type PidMode
- type RestartPolicy
Constants ¶
This section is empty.
Variables ¶
var ( ErrConflictContainerNetworkAndLinks = fmt.Errorf("Conflicting options: --net=container can't be used with links. This would result in undefined behavior.") ErrConflictContainerNetworkAndDns = fmt.Errorf("Conflicting options: --net=container can't be used with --dns. This configuration is invalid.") ErrConflictNetworkHostname = fmt.Errorf("Conflicting options: -h and the network mode (--net)") ErrConflictHostNetworkAndDns = fmt.Errorf("Conflicting options: --net=host can't be used with --dns. This configuration is invalid.") ErrConflictHostNetworkAndLinks = fmt.Errorf("Conflicting options: --net=host can't be used with links. This would result in undefined behavior.") )
Functions ¶
func Compare ¶
Compare two Config struct. Do not compare the "Image" nor "Hostname" fields If OpenStdin is set, then it differs
func DecodeContainerConfig ¶
func DecodeContainerConfig(src io.Reader) (*Config, *HostConfig, error)
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewCommand ¶
func (*Command) MarshalJSON ¶
func (*Command) UnmarshalJSON ¶
UnmarshalJSON decoded the entrypoint whether it's a string or an array of strings.
type Config ¶
type Config struct {
Hostname string
Domainname string
User string
AttachStdin bool
AttachStdout bool
AttachStderr bool
PortSpecs []string // Deprecated - Can be in the format of 8080/tcp
ExposedPorts map[nat.Port]struct{}
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
Cmd *Command
Image string // Name of the image as it was passed by the operator (eg. could be symbolic)
Volumes map[string]struct{}
WorkingDir string
Entrypoint *Entrypoint
NetworkDisabled bool
MacAddress string
OnBuild []string
Labels map[string]string
}
Note: the Config structure 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.
type ContainerConfigWrapper ¶
type ContainerConfigWrapper struct {
*Config
// contains filtered or unexported fields
}
func MergeConfigs ¶
func MergeConfigs(config *Config, hostConfig *HostConfig) *ContainerConfigWrapper
func (ContainerConfigWrapper) GetHostConfig ¶
func (w ContainerConfigWrapper) GetHostConfig() *HostConfig
func (ContainerConfigWrapper) HostConfig ¶
func (c ContainerConfigWrapper) HostConfig() *HostConfig
type DeviceMapping ¶
func ParseDevice ¶
func ParseDevice(device string) (DeviceMapping, error)
type Entrypoint ¶
type Entrypoint struct {
// contains filtered or unexported fields
}
Entrypoint encapsulates the container entrypoint. It might be represented as a string or an array of strings. We need to override the json decoder to accept both options. The JSON decoder will fail if the api sends an string and
we try to decode it into an array of string.
func NewEntrypoint ¶
func NewEntrypoint(parts ...string) *Entrypoint
func (*Entrypoint) Len ¶
func (e *Entrypoint) Len() int
func (*Entrypoint) MarshalJSON ¶
func (e *Entrypoint) MarshalJSON() ([]byte, error)
func (*Entrypoint) Slice ¶
func (e *Entrypoint) Slice() []string
func (*Entrypoint) UnmarshalJSON ¶
func (e *Entrypoint) UnmarshalJSON(b []byte) error
UnmarshalJSON decoded the entrypoint whether it's a string or an array of strings.
type ExecConfig ¶
type HostConfig ¶
type HostConfig struct {
Binds []string
ContainerIDFile string
LxcConf *LxcConfig
Memory int64 // Memory limit (in bytes)
MemorySwap int64 // Total memory usage (memory + swap); set `-1` to disable swap
CpusetCpus string // CpusetCpus 0-2, 0,1
CpusetMems string // CpusetMems 0-2, 0,1
CpuQuota int64
OomKillDisable bool // Whether to disable OOM Killer or not
Privileged bool
PortBindings nat.PortMap
Links []string
PublishAllPorts bool
Dns []string
DnsSearch []string
ExtraHosts []string
VolumesFrom []string
Devices []DeviceMapping
NetworkMode NetworkMode
IpcMode IpcMode
PidMode PidMode
CapAdd []string
CapDrop []string
RestartPolicy RestartPolicy
SecurityOpt []string
ReadonlyRootfs bool
Ulimits []*ulimit.Ulimit
LogConfig LogConfig
CgroupParent string // Parent cgroup.
}
func DecodeHostConfig ¶
func DecodeHostConfig(src io.Reader) (*HostConfig, error)
type IpcMode ¶
type IpcMode string
func (IpcMode) IsContainer ¶
type KeyValuePair ¶
type LxcConfig ¶
type LxcConfig struct {
// contains filtered or unexported fields
}
func NewLxcConfig ¶
func NewLxcConfig(values []KeyValuePair) *LxcConfig
func (*LxcConfig) MarshalJSON ¶
func (*LxcConfig) Slice ¶
func (c *LxcConfig) Slice() []KeyValuePair
func (*LxcConfig) UnmarshalJSON ¶
type NetworkMode ¶
type NetworkMode string
func (NetworkMode) IsContainer ¶
func (n NetworkMode) IsContainer() bool
func (NetworkMode) IsHost ¶
func (n NetworkMode) IsHost() bool
func (NetworkMode) IsNone ¶
func (n NetworkMode) IsNone() bool
func (NetworkMode) IsPrivate ¶
func (n NetworkMode) IsPrivate() bool
IsPrivate indicates whether container use it's private network stack
type PidMode ¶
type PidMode string
type RestartPolicy ¶
func ParseRestartPolicy ¶
func ParseRestartPolicy(policy string) (RestartPolicy, error)
ParseRestartPolicy returns the parsed policy or an error indicating what is incorrect