docker

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2020 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Addr      string
	PrefixLen int
}

Address represents an IP address

type Backend

type Backend struct {
	Dockerfile      string           `json:"dockerfile,omitempty"`
	Image           string           `json:"image,omitempty"`
	Persistent      bool             `json:"persistent,omitempty"`
	Ports           []*PortMapping   `json:"ports,omitempty"`
	ContainerName   string           `json:"containerName,omitempty"`
	ContainerConfig Config           `json:"containerConfig,omitempty"`
	HostConfig      HostConfig       `json:"hostConfig,omitempty"`
	NetworkConfig   NetworkingConfig `json:"networkConfig,omitempty"`
}

func (*Backend) HasBuildStep

func (d *Backend) HasBuildStep() bool

func (*Backend) HasLaunchStep

func (d *Backend) HasLaunchStep() bool

func (*Backend) MarshalJSON

func (d *Backend) MarshalJSON() ([]byte, error)

func (*Backend) UnmarshalJSON

func (d *Backend) UnmarshalJSON(data []byte) error

type BindOptions

type BindOptions struct {
	Propagation string `json:"propagation,omitempty"`
}

BindOptions contains optional configuration for the bind type

type BlockLimit

type BlockLimit struct {
	Path string `json:"path,omitempty"`
	Rate int64  `json:"rate,omitempty"`
}

BlockLimit represents a read/write limit in IOPS or Bandwidth for a device inside of a container

type BlockWeight

type BlockWeight struct {
	Path   string `json:"path,omitempty"`
	Weight string `json:"weight,omitempty"`
}

BlockWeight represents a relative device weight for an individual device inside of a container

type Config

type Config struct {
	Hostname          string            `json:"hostname,omitempty"`
	Domainname        string            `json:"domainname,omitempty"`
	User              string            `json:"user,omitempty"`
	Memory            int64             `json:"memory,omitempty"`
	MemorySwap        int64             `json:"memorySwap,omitempty"`
	MemoryReservation int64             `json:"memoryReservation,omitempty"`
	KernelMemory      int64             `json:"kernelMemory,omitempty"`
	CPUShares         int64             `json:"cpuShares,omitempty"`
	CPUSet            string            `json:"cpuset,omitempty"`
	PortSpecs         []string          `json:"portSpecs,omitempty"`
	ExposedPorts      map[Port]struct{} `json:"exposedPorts,omitempty"`
	PublishService    string            `json:"publishService,omitempty"`
	StopSignal        string            `json:"stopSignal,omitempty"`
	StopTimeout       int               `json:"stopTimeout,omitempty"`
	Env               []string          `json:"env,omitempty"`
	Cmd               []string          `json:"cmd"`
	Healthcheck       *HealthConfig     `json:"healthcheck,omitempty"`
	DNS               []string          `json:"dns,omitempty"` // For Docker API v1.9 and below only
	Volumes           []string          `json:"volumes,omitempty"`
	VolumeDriver      string            `json:"volumeDriver,omitempty"`
	WorkingDir        string            `json:"workingDir,omitempty"`
	MacAddress        string            `json:"macAddress,omitempty"`
	Entrypoint        []string          `json:"entrypoint"`
	SecurityOpts      []string          `json:"securityOpts,omitempty"`
	OnBuild           []string          `json:"onBuild,omitempty"`
	Mounts            []Mount           `json:"mounts,omitempty"`
	Labels            map[string]string `json:"labels,omitempty"`
	AttachStdin       bool              `json:"attachStdin,omitempty"`
	AttachStdout      bool              `json:"attachStdout,omitempty"`
	AttachStderr      bool              `json:"attachStderr,omitempty"`
	ArgsEscaped       bool              `json:"argsEscaped,omitempty"`
	Tty               bool              `json:"tty,omitempty"`
	OpenStdin         bool              `json:"openStdin,omitempty"`
	StdinOnce         bool              `json:"stdinOnce,omitempty"`
	NetworkDisabled   bool              `json:"networkDisabled,omitempty"`
}

Config is the list of configuration options used when creating a container. Config does not contain the options that are specific to starting a container on a given host. Those are contained in HostConfig

type Device

type Device struct {
	PathOnHost        string `json:"pathOnHost,omitempty"`
	PathInContainer   string `json:"pathInContainer,omitempty"`
	CgroupPermissions string `json:"cgroupPermissions,omitempty"`
}

Device represents a device mapping between the Docker host and the container.

type EndpointIPAMConfig

type EndpointIPAMConfig struct {
	IPv4Address  string   `json:",omitempty"`
	IPv6Address  string   `json:",omitempty"`
	LinkLocalIPs []string `json:",omitempty"`
}

EndpointIPAMConfig represents IPAM configurations for the endpoint

type EndpointSettings

type EndpointSettings struct {
	// Configurations
	IPAMConfig *EndpointIPAMConfig
	Links      []string
	Aliases    []string
	// Operational data
	NetworkID           string
	EndpointID          string
	Gateway             string
	IPAddress           string
	IPPrefixLen         int
	IPv6Gateway         string
	GlobalIPv6Address   string
	GlobalIPv6PrefixLen int
	MacAddress          string
}

EndpointSettings stores the network endpoint details

type HealthConfig

type HealthConfig struct {
	// Test is the test to perform to check that the container is healthy.
	// An empty slice means to inherit the default.
	// The options are:
	// {} : inherit healthcheck
	// {"NONE"} : disable healthcheck
	// {"CMD", args...} : exec arguments directly
	// {"CMD-SHELL", command} : run command with system's default shell
	Test []string `json:"test,omitempty"`

	// Zero means to inherit. Durations are expressed as integer nanoseconds.
	Interval    time.Duration `json:"interval,omitempty"`    // Interval is the time to wait between checks.
	Timeout     time.Duration `json:"timeout,omitempty"`     // Timeout is the time to wait before considering the check to have hung.
	StartPeriod time.Duration `json:"startPeriod,omitempty"` // The start period for the container to initialize before the retries starts to count down.

	// Retries is the number of consecutive failures needed to consider a container as unhealthy.
	// Zero means inherit.
	Retries int `json:"retries,omitempty"`
}

HealthConfig holds configuration settings for the HEALTHCHECK feature

It has been added in the version 1.24 of the Docker API, available since Docker 1.12.

type HostConfig

type HostConfig struct {
	Binds                []string               `json:"binds,omitempty"`
	CapAdd               []string               `json:"capAdd,omitempty"`
	CapDrop              []string               `json:"capDrop,omitempty"`
	GroupAdd             []string               `json:"groupAdd,omitempty"`
	ContainerIDFile      string                 `json:"containerIDFile,omitempty"`
	LxcConf              []KeyValuePair         `json:"lxcConf,omitempty"`
	PortBindings         map[Port][]PortBinding `json:"portBindings,omitempty"`
	Links                []string               `json:"links,omitempty"`
	DNS                  []string               `json:"dns,omitempty"` // For Docker API v1.10 and above only
	DNSOptions           []string               `json:"dnsOptions,omitempty"`
	DNSSearch            []string               `json:"dnsSearch,omitempty"`
	ExtraHosts           []string               `json:"extraHosts,omitempty"`
	VolumesFrom          []string               `json:"volumesFrom,omitempty"`
	UsernsMode           string                 `json:"usernsMode,omitempty"`
	NetworkMode          string                 `json:"networkMode,omitempty"`
	IpcMode              string                 `json:"ipcMode,omitempty"`
	PidMode              string                 `json:"pidMode,omitempty"`
	UTSMode              string                 `json:"utsMode,omitempty"`
	RestartPolicy        RestartPolicy          `json:"restartPolicy,omitempty"`
	Devices              []Device               `json:"devices,omitempty"`
	DeviceCgroupRules    []string               `json:"deviceCgroupRules,omitempty"`
	LogConfig            LogConfig              `json:"logConfig,omitempty"`
	SecurityOpt          []string               `json:"securityOpt,omitempty"`
	Cgroup               string                 `json:"cgroup,omitempty"`
	CgroupParent         string                 `json:"cgroupParent,omitempty"`
	Memory               int64                  `json:"memory,omitempty"`
	MemoryReservation    int64                  `json:"memoryReservation,omitempty"`
	KernelMemory         int64                  `json:"kernelMemory,omitempty"`
	MemorySwap           int64                  `json:"memorySwap,omitempty"`
	MemorySwappiness     int64                  `json:"memorySwappiness,omitempty"`
	CPUShares            int64                  `json:"cpuShares,omitempty"`
	CPUSet               string                 `json:"cpuset,omitempty"`
	CPUSetCPUs           string                 `json:"cpusetCpus,omitempty"`
	CPUSetMEMs           string                 `json:"cpusetMems,omitempty"`
	CPUQuota             int64                  `json:"cpuQuota,omitempty"`
	CPUPeriod            int64                  `json:"cpuPeriod,omitempty"`
	CPURealtimePeriod    int64                  `json:"cpuRealtimePeriod,omitempty"`
	CPURealtimeRuntime   int64                  `json:"cpuRealtimeRuntime,omitempty"`
	BlkioWeight          int64                  `json:"blkioWeight,omitempty"`
	BlkioWeightDevice    []BlockWeight          `json:"blkioWeightDevice,omitempty"`
	BlkioDeviceReadBps   []BlockLimit           `json:"blkioDeviceReadBps,omitempty"`
	BlkioDeviceReadIOps  []BlockLimit           `json:"blkioDeviceReadIOps,omitempty"`
	BlkioDeviceWriteBps  []BlockLimit           `json:"blkioDeviceWriteBps,omitempty"`
	BlkioDeviceWriteIOps []BlockLimit           `json:"blkioDeviceWriteIOps,omitempty"`
	Ulimits              []ULimit               `json:"ulimits,omitempty"`
	VolumeDriver         string                 `json:"volumeDriver,omitempty"`
	OomScoreAdj          int                    `json:"oomScoreAdj,omitempty"`
	PidsLimit            int64                  `json:"pidsLimit,omitempty"`
	ShmSize              int64                  `json:"shmSize,omitempty"`
	Tmpfs                map[string]string      `json:"tmpfs,omitempty"`
	Privileged           bool                   `json:"privileged,omitempty"`
	PublishAllPorts      bool                   `json:"publishAllPorts,omitempty"`
	ReadonlyRootfs       bool                   `json:"readonlyRootfs,omitempty"`
	OOMKillDisable       bool                   `json:"oomKillDisable,omitempty"`
	AutoRemove           bool                   `json:"autoRemove,omitempty"`
	StorageOpt           map[string]string      `json:"storageOpt,omitempty"`
	Sysctls              map[string]string      `json:"sysctls,omitempty"`
	CPUCount             int64                  `json:"cpuCount,omitempty"`
	CPUPercent           int64                  `json:"cpuPercent,omitempty"`
	IOMaximumBandwidth   int64                  `json:"ioMaximumBandwidth,omitempty"`
	IOMaximumIOps        int64                  `json:"ioMaximumIOps,omitempty"`
	Mounts               []HostMount            `json:"mounts,omitempty"`
}

HostConfig contains the container options related to starting a container on a given host

type HostMount

type HostMount struct {
	Target        string         `json:"target,omitempty"`
	Source        string         `json:"source,omitempty"`
	Type          string         `json:"type,omitempty"`
	ReadOnly      bool           `json:"readOnly,omitempty"`
	BindOptions   *BindOptions   `json:"bindOptions,omitempty"`
	VolumeOptions *VolumeOptions `json:"volumeOptions,omitempty"`
	TempfsOptions *TempfsOptions `json:"tempfsOptions,omitempty"`
}

HostMount represents a mount point in the container in HostConfig.

It has been added in the version 1.25 of the Docker API

type IPAM

type IPAM struct {
	Driver  string
	Options map[string]string //Per network IPAM driver options
	Config  []IPAMConfig
}

IPAM represents IP Address Management

type IPAMConfig

type IPAMConfig struct {
	Subnet     string            `json:",omitempty"`
	IPRange    string            `json:",omitempty"`
	Gateway    string            `json:",omitempty"`
	AuxAddress map[string]string `json:"AuxiliaryAddresses,omitempty"`
}

IPAMConfig represents IPAM configurations

type KeyValuePair

type KeyValuePair struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

KeyValuePair is a type for generic key/value pairs as used in the Lxc configuration

type Loader

type Loader struct {
}

func (*Loader) Builder

func (l *Loader) Builder(s *services.ServiceConfig, backend services.Backend) (services.Builder, error)

func (*Loader) Handles

func (l *Loader) Handles(c services.Backend) bool

func (*Loader) Name

func (l *Loader) Name() string

func (*Loader) New

func (l *Loader) New() services.Backend

func (*Loader) Runner

func (l *Loader) Runner(s *services.ServiceConfig, backend services.Backend) (services.Runner, error)

type LogConfig

type LogConfig struct {
	Type   string            `json:"type,omitempty"`
	Config map[string]string `json:"config,omitempty"`
}

LogConfig defines the log driver type and the configuration for it.

type Mount

type Mount struct {
	Name        string `json:"name"`
	Source      string `json:"source"`
	Destination string `json:"destination"`
	Driver      string `json:"driver"`
	Mode        string `json:"mode"`
	RW          bool   `json:"rw"`
}

Mount represents a mount point in the container.

It has been added in the version 1.20 of the Docker API, available since Docker 1.8.

type NetworkingConfig

type NetworkingConfig struct {
	EndpointsConfig map[string]*EndpointSettings // Endpoint configs for each connecting network
}

NetworkingConfig represents the container's networking configuration for each of its interfaces Carries the networking configs specified in the `docker run` and `docker network connect` commands

type PeerInfo

type PeerInfo struct {
	Name string
	IP   string
}

PeerInfo represents one peer of a overlay network

type Port

type Port string

Port represents the port number and the protocol, in the form <number>/<protocol>. For example: 80/tcp.

type PortBinding

type PortBinding struct {
	HostIP   string `json:"hostIp,omitempty"`
	HostPort string `json:"hostPort,omitempty"`
}

PortBinding represents the host/container port mapping as returned in the `docker inspect` json

type PortMapping

type PortMapping struct {
	ContainerPort Port
	HostPort      Port

	Original string
}

func (*PortMapping) MarshalJSON

func (p *PortMapping) MarshalJSON() ([]byte, error)

func (*PortMapping) UnmarshalJSON

func (p *PortMapping) UnmarshalJSON(data []byte) error

type RestartPolicy

type RestartPolicy struct {
	Name              string `json:"name,omitempty"`
	MaximumRetryCount int    `json:"maximumRetryCount,omitempty"`
}

RestartPolicy represents the policy for automatically restarting a container.

Possible values are:

  • always: the docker daemon will always restart the container
  • on-failure: the docker daemon will restart the container on failures, at most MaximumRetryCount times
  • unless-stopped: the docker daemon will always restart the container except when user has manually stopped the container
  • no: the docker daemon will not restart the container automatically

type TempfsOptions

type TempfsOptions struct {
	SizeBytes int64 `json:"sizeBytes,omitempty"`
	Mode      int   `json:"mode,omitempty"`
}

TempfsOptions contains optional configuration for the tempfs type

type ULimit

type ULimit struct {
	Name string `json:"name,omitempty"`
	Soft int64  `json:"soft,omitempty"`
	Hard int64  `json:"hard,omitempty"`
}

ULimit defines system-wide resource limitations This can help a lot in system administration, e.g. when a user starts too many processes and therefore makes the system unresponsive for other users.

type VolumeDriverConfig

type VolumeDriverConfig struct {
	Name    string            `json:"name,omitempty"`
	Options map[string]string `json:"options,omitempty"`
}

VolumeDriverConfig holds a map of volume driver specific options

type VolumeOptions

type VolumeOptions struct {
	NoCopy       bool               `json:"noCopy,omitempty"`
	Labels       map[string]string  `json:"labels,omitempty"`
	DriverConfig VolumeDriverConfig `json:"driverConfig,omitempty"`
}

VolumeOptions contains optional configuration for the volume type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL