docker

package module
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: BSD-2-Clause Imports: 34 Imported by: 0

README

go-dockerclient

Travis Build Status AppVeyor Build status GoDoc

This package presents a client for the Docker remote API. It also provides support for the extensions in the Swarm API.

This package also provides support for docker's network API, which is a simple passthrough to the libnetwork remote API.

For more details, check the remote API documentation.

Difference between go-dockerclient and the official SDK

Link for the official SDK: https://docs.docker.com/develop/sdk/

go-dockerclient was created before Docker had an official Go SDK and is still maintained and relatively active because it's still used out there. New features in the Docker API do not get automatically implemented here: it's based on demand, if someone wants it, they can file an issue or a PR and the feature may get implemented/merged.

For new projects, using the official SDK is probably more appropriate as go-dockerclient lags behind the official SDK.

Example

package main

import (
	"fmt"

	docker "github.com/fsouza/go-dockerclient"
)

func main() {
	endpoint := "unix:///var/run/docker.sock"
	client, err := docker.NewClient(endpoint)
	if err != nil {
		panic(err)
	}
	imgs, err := client.ListImages(docker.ListImagesOptions{All: false})
	if err != nil {
		panic(err)
	}
	for _, img := range imgs {
		fmt.Println("ID: ", img.ID)
		fmt.Println("RepoTags: ", img.RepoTags)
		fmt.Println("Created: ", img.Created)
		fmt.Println("Size: ", img.Size)
		fmt.Println("VirtualSize: ", img.VirtualSize)
		fmt.Println("ParentId: ", img.ParentID)
	}
}

Using with TLS

In order to instantiate the client for a TLS-enabled daemon, you should use NewTLSClient, passing the endpoint and path for key and certificates as parameters.

package main

import (
	"fmt"

	docker "github.com/fsouza/go-dockerclient"
)

func main() {
	endpoint := "tcp://[ip]:[port]"
	path := os.Getenv("DOCKER_CERT_PATH")
	ca := fmt.Sprintf("%s/ca.pem", path)
	cert := fmt.Sprintf("%s/cert.pem", path)
	key := fmt.Sprintf("%s/key.pem", path)
	client, _ := docker.NewTLSClient(endpoint, cert, key, ca)
	// use client
}

If using docker-machine, or another application that exports environment variables DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH, you can use NewClientFromEnv.

package main

import (
	"fmt"

	docker "github.com/fsouza/go-dockerclient"
)

func main() {
	client, _ := docker.NewClientFromEnv()
	// use client
}

See the documentation for more details.

Developing

All development commands can be seen in the Makefile.

Commited code must pass:

Running make test will check all of these. If your editor does not automatically call gofmt -s, make sure you invoke it manually.

Vendoring / Modules

go-dockerclient supports dep for vendoring and can also be installed as a module. If you're using dep or Go modules, you should be able to pick go-dockerclient releases and get the proper dependencies.

With other vendoring tools, users might need to specify go-dockerclient's dependencies manually.

Using with Docker 1.9 and Go 1.4

There's a tag for using go-dockerclient with Docker 1.9 (which requires compiling go-dockerclient with Go 1.4), the tag name is docker-1.9/go-1.4.

The instructions below can be used to get a version of go-dockerclient that compiles with Go 1.4:

% git clone -b docker-1.9/go-1.4 https://github.com/fsouza/go-dockerclient.git $GOPATH/src/github.com/fsouza/go-dockerclient
% git clone -b v1.9.1 https://github.com/docker/docker.git $GOPATH/src/github.com/docker/docker
% go get github.com/fsouza/go-dockerclient

Documentation

Overview

Package docker provides a client for the Docker remote API.

See https://goo.gl/o2v3rk for more details on the remote API.

Index

Examples

Constants

View Source
const (
	SIGABRT   = Signal(0x6)
	SIGALRM   = Signal(0xe)
	SIGBUS    = Signal(0x7)
	SIGCHLD   = Signal(0x11)
	SIGCLD    = Signal(0x11)
	SIGCONT   = Signal(0x12)
	SIGFPE    = Signal(0x8)
	SIGHUP    = Signal(0x1)
	SIGILL    = Signal(0x4)
	SIGINT    = Signal(0x2)
	SIGIO     = Signal(0x1d)
	SIGIOT    = Signal(0x6)
	SIGKILL   = Signal(0x9)
	SIGPIPE   = Signal(0xd)
	SIGPOLL   = Signal(0x1d)
	SIGPROF   = Signal(0x1b)
	SIGPWR    = Signal(0x1e)
	SIGQUIT   = Signal(0x3)
	SIGSEGV   = Signal(0xb)
	SIGSTKFLT = Signal(0x10)
	SIGSTOP   = Signal(0x13)
	SIGSYS    = Signal(0x1f)
	SIGTERM   = Signal(0xf)
	SIGTRAP   = Signal(0x5)
	SIGTSTP   = Signal(0x14)
	SIGTTIN   = Signal(0x15)
	SIGTTOU   = Signal(0x16)
	SIGUNUSED = Signal(0x1f)
	SIGURG    = Signal(0x17)
	SIGUSR1   = Signal(0xa)
	SIGUSR2   = Signal(0xc)
	SIGVTALRM = Signal(0x1a)
	SIGWINCH  = Signal(0x1c)
	SIGXCPU   = Signal(0x18)
	SIGXFSZ   = Signal(0x19)
)

These values represent all signals available on Linux, where containers will be running.

Variables

View Source
var (
	// ErrInvalidEndpoint is returned when the endpoint is not a valid HTTP URL.
	ErrInvalidEndpoint = errors.New("invalid endpoint")

	// ErrConnectionRefused is returned when the client cannot connect to the given endpoint.
	ErrConnectionRefused = errors.New("cannot connect to Docker endpoint")

	// ErrInactivityTimeout is returned when a streamable call has been inactive for some time.
	ErrInactivityTimeout = errors.New("inactivity time exceeded timeout")
)
View Source
var (
	// ErrNoListeners is the error returned when no listeners are available
	// to receive an event.
	ErrNoListeners = errors.New("no listeners present to receive event")

	// ErrListenerAlreadyExists is the error returned when the listerner already
	// exists.
	ErrListenerAlreadyExists = errors.New("listener already exists for docker events")

	// ErrTLSNotSupported is the error returned when the client does not support
	// TLS (this applies to the Windows named pipe client).
	ErrTLSNotSupported = errors.New("tls not supported by this client")

	// EOFEvent is sent when the event listener receives an EOF error.
	EOFEvent = &APIEvents{
		Type:   "EOF",
		Status: "EOF",
	}
)
View Source
var (
	// ErrNoSuchImage is the error returned when the image does not exist.
	ErrNoSuchImage = errors.New("no such image")

	// ErrMissingRepo is the error returned when the remote repository is
	// missing.
	ErrMissingRepo = errors.New("missing remote repository e.g. 'github.com/user/repo'")

	// ErrMissingOutputStream is the error returned when no output stream
	// is provided to some calls, like BuildImage.
	ErrMissingOutputStream = errors.New("missing output stream")

	// ErrMultipleContexts is the error returned when both a ContextDir and
	// InputStream are provided in BuildImageOptions
	ErrMultipleContexts = errors.New("image build may not be provided BOTH context dir and input stream")

	// ErrMustSpecifyNames is the error rreturned when the Names field on
	// ExportImagesOptions is nil or empty
	ErrMustSpecifyNames = errors.New("must specify at least one name to export")
)
View Source
var (
	// ErrNodeAlreadyInSwarm is the error returned by InitSwarm and JoinSwarm
	// when the node is already part of a Swarm.
	ErrNodeAlreadyInSwarm = errors.New("node already in a Swarm")

	// ErrNodeNotInSwarm is the error returned by LeaveSwarm and UpdateSwarm
	// when the node is not part of a Swarm.
	ErrNodeNotInSwarm = errors.New("node is not in a Swarm")
)
View Source
var (
	// ErrNoSuchVolume is the error returned when the volume does not exist.
	ErrNoSuchVolume = errors.New("no such volume")

	// ErrVolumeInUse is the error returned when the volume requested to be removed is still in use.
	ErrVolumeInUse = errors.New("volume in use and cannot be removed")
)
View Source
var ErrCannotParseDockercfg = errors.New("failed to read authentication from dockercfg")

ErrCannotParseDockercfg is the error returned by NewAuthConfigurations when the dockercfg cannot be parsed.

View Source
var ErrContainerAlreadyExists = errors.New("container already exists")

ErrContainerAlreadyExists is the error returned by CreateContainer when the container already exists.

View Source
var ErrNetworkAlreadyExists = errors.New("network already exists")

ErrNetworkAlreadyExists is the error returned by CreateNetwork when the network already exists.

Functions

func ParseRepositoryTag

func ParseRepositoryTag(repoTag string) (repository string, tag string)

ParseRepositoryTag gets the name of the repository and returns it splitted in two parts: the repository and the tag. It ignores the digest when it is present.

Some examples:

localhost.localdomain:5000/samalba/hipache:latest -> localhost.localdomain:5000/samalba/hipache, latest
localhost.localdomain:5000/samalba/hipache -> localhost.localdomain:5000/samalba/hipache, ""
busybox:latest@sha256:4a731fb46adc5cefe3ae374a8b6020fc1b6ad667a279647766e9a3cd89f6fa92 -> busybox, latest

Types

type APIActor

type APIActor struct {
	ID         string            `json:"id,omitempty"`
	Attributes map[string]string `json:"attributes,omitempty"`
}

APIActor represents an actor that accomplishes something for an event

type APIContainers

type APIContainers struct {
	ID         string            `json:"Id" yaml:"Id" toml:"Id"`
	Image      string            `json:"Image,omitempty" yaml:"Image,omitempty" toml:"Image,omitempty"`
	Command    string            `json:"Command,omitempty" yaml:"Command,omitempty" toml:"Command,omitempty"`
	Created    int64             `json:"Created,omitempty" yaml:"Created,omitempty" toml:"Created,omitempty"`
	State      string            `json:"State,omitempty" yaml:"State,omitempty" toml:"State,omitempty"`
	Status     string            `json:"Status,omitempty" yaml:"Status,omitempty" toml:"Status,omitempty"`
	Ports      []APIPort         `json:"Ports,omitempty" yaml:"Ports,omitempty" toml:"Ports,omitempty"`
	SizeRw     int64             `json:"SizeRw,omitempty" yaml:"SizeRw,omitempty" toml:"SizeRw,omitempty"`
	SizeRootFs int64             `json:"SizeRootFs,omitempty" yaml:"SizeRootFs,omitempty" toml:"SizeRootFs,omitempty"`
	Names      []string          `json:"Names,omitempty" yaml:"Names,omitempty" toml:"Names,omitempty"`
	Labels     map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty" toml:"Labels,omitempty"`
	Networks   NetworkList       `json:"NetworkSettings,omitempty" yaml:"NetworkSettings,omitempty" toml:"NetworkSettings,omitempty"`
	Mounts     []APIMount        `json:"Mounts,omitempty" yaml:"Mounts,omitempty" toml:"Mounts,omitempty"`
}

APIContainers represents each container in the list returned by ListContainers.

type APIEvents

type APIEvents struct {
	// New API Fields in 1.22
	Action string   `json:"action,omitempty"`
	Type   string   `json:"type,omitempty"`
	Actor  APIActor `json:"actor,omitempty"`

	// Old API fields for < 1.22
	Status string `json:"status,omitempty"`
	ID     string `json:"id,omitempty"`
	From   string `json:"from,omitempty"`

	// Fields in both
	Time     int64 `json:"time,omitempty"`
	TimeNano int64 `json:"timeNano,omitempty"`
}

APIEvents represents events coming from the Docker API The fields in the Docker API changed in API version 1.22, and events for more than images and containers are now fired off. To maintain forward and backward compatibility, go-dockerclient replicates the event in both the new and old format as faithfully as possible.

For events that only exist in 1.22 in later, `Status` is filled in as `"Type:Action"` instead of just `Action` to allow for older clients to differentiate and not break if they rely on the pre-1.22 Status types.

The transformEvent method can be consulted for more information about how events are translated from new/old API formats

type APIImageSearch

type APIImageSearch struct {
	Description string `json:"description,omitempty" yaml:"description,omitempty" toml:"description,omitempty"`
	IsOfficial  bool   `json:"is_official,omitempty" yaml:"is_official,omitempty" toml:"is_official,omitempty"`
	IsAutomated bool   `json:"is_automated,omitempty" yaml:"is_automated,omitempty" toml:"is_automated,omitempty"`
	Name        string `json:"name,omitempty" yaml:"name,omitempty" toml:"name,omitempty"`
	StarCount   int    `json:"star_count,omitempty" yaml:"star_count,omitempty" toml:"star_count,omitempty"`
}

APIImageSearch reflect the result of a search on the Docker Hub.

See https://goo.gl/KLO9IZ for more details.

type APIImages

type APIImages struct {
	ID          string            `json:"Id" yaml:"Id" toml:"Id"`
	RepoTags    []string          `json:"RepoTags,omitempty" yaml:"RepoTags,omitempty" toml:"RepoTags,omitempty"`
	Created     int64             `json:"Created,omitempty" yaml:"Created,omitempty" toml:"Created,omitempty"`
	Size        int64             `json:"Size,omitempty" yaml:"Size,omitempty" toml:"Size,omitempty"`
	VirtualSize int64             `json:"VirtualSize,omitempty" yaml:"VirtualSize,omitempty" toml:"VirtualSize,omitempty"`
	ParentID    string            `json:"ParentId,omitempty" yaml:"ParentId,omitempty" toml:"ParentId,omitempty"`
	RepoDigests []string          `json:"RepoDigests,omitempty" yaml:"RepoDigests,omitempty" toml:"RepoDigests,omitempty"`
	Labels      map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty" toml:"Labels,omitempty"`
}

APIImages represent an image returned in the ListImages call.

type APIMount

type APIMount struct {
	Name        string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
	Source      string `json:"Source,omitempty" yaml:"Source,omitempty" toml:"Source,omitempty"`
	Destination string `json:"Destination,omitempty" yaml:"Destination,omitempty" toml:"Destination,omitempty"`
	Driver      string `json:"Driver,omitempty" yaml:"Driver,omitempty" toml:"Driver,omitempty"`
	Mode        string `json:"Mode,omitempty" yaml:"Mode,omitempty" toml:"Mode,omitempty"`
	RW          bool   `json:"RW,omitempty" yaml:"RW,omitempty" toml:"RW,omitempty"`
	Propagation string `json:"Propagation,omitempty" yaml:"Propagation,omitempty" toml:"Propagation,omitempty"`
}

APIMount represents a mount point for a container.

type APIPort

type APIPort struct {
	PrivatePort int64  `json:"PrivatePort,omitempty" yaml:"PrivatePort,omitempty" toml:"PrivatePort,omitempty"`
	PublicPort  int64  `json:"PublicPort,omitempty" yaml:"PublicPort,omitempty" toml:"PublicPort,omitempty"`
	Type        string `json:"Type,omitempty" yaml:"Type,omitempty" toml:"Type,omitempty"`
	IP          string `json:"IP,omitempty" yaml:"IP,omitempty" toml:"IP,omitempty"`
}

APIPort is a type that represents a port mapping returned by the Docker API

type APIVersion

type APIVersion []int

APIVersion is an internal representation of a version of the Remote API.

func NewAPIVersion

func NewAPIVersion(input string) (APIVersion, error)

NewAPIVersion returns an instance of APIVersion for the given string.

The given string must be in the form <major>.<minor>.<patch>, where <major>, <minor> and <patch> are integer numbers.

func (APIVersion) GreaterThan

func (version APIVersion) GreaterThan(other APIVersion) bool

GreaterThan is a function for comparing APIVersion structs

func (APIVersion) GreaterThanOrEqualTo

func (version APIVersion) GreaterThanOrEqualTo(other APIVersion) bool

GreaterThanOrEqualTo is a function for comparing APIVersion structs

func (APIVersion) LessThan

func (version APIVersion) LessThan(other APIVersion) bool

LessThan is a function for comparing APIVersion structs

func (APIVersion) LessThanOrEqualTo

func (version APIVersion) LessThanOrEqualTo(other APIVersion) bool

LessThanOrEqualTo is a function for comparing APIVersion structs

func (APIVersion) String

func (version APIVersion) String() string

type AttachToContainerOptions

type AttachToContainerOptions struct {
	Container    string    `qs:"-"`
	InputStream  io.Reader `qs:"-"`
	OutputStream io.Writer `qs:"-"`
	ErrorStream  io.Writer `qs:"-"`

	// If set, after a successful connect, a sentinel will be sent and then the
	// client will block on receive before continuing.
	//
	// It must be an unbuffered channel. Using a buffered channel can lead
	// to unexpected behavior.
	Success chan struct{}

	// Use raw terminal? Usually true when the container contains a TTY.
	RawTerminal bool `qs:"-"`

	// Get container logs, sending it to OutputStream.
	Logs bool

	// Stream the response?
	Stream bool

	// Attach to stdin, and use InputStream.
	Stdin bool

	// Attach to stdout, and use OutputStream.
	Stdout bool

	// Attach to stderr, and use ErrorStream.
	Stderr bool
}

AttachToContainerOptions is the set of options that can be used when attaching to a container.

See https://goo.gl/JF10Zk for more details.

type AuthConfiguration

type AuthConfiguration struct {
	Username      string `json:"username,omitempty"`
	Password      string `json:"password,omitempty"`
	Email         string `json:"email,omitempty"`
	ServerAddress string `json:"serveraddress,omitempty"`

	// IdentityToken can be supplied with the identitytoken response of the AuthCheck call
	// see https://godoc.org/github.com/docker/docker/api/types#AuthConfig
	// It can be used in place of password not in conjunction with it
	IdentityToken string `json:"identitytoken,omitempty"`

	// RegistryToken can be supplied with the registrytoken
	RegistryToken string `json:"registrytoken,omitempty"`
}

AuthConfiguration represents authentication options to use in the PushImage method. It represents the authentication in the Docker index server.

type AuthConfigurations

type AuthConfigurations struct {
	Configs map[string]AuthConfiguration `json:"configs"`
}

AuthConfigurations represents authentication options to use for the PushImage method accommodating the new X-Registry-Config header

func NewAuthConfigurations

func NewAuthConfigurations(r io.Reader) (*AuthConfigurations, error)

NewAuthConfigurations returns AuthConfigurations from a JSON encoded string in the same format as the .dockercfg file.

func NewAuthConfigurationsFromDockerCfg

func NewAuthConfigurationsFromDockerCfg() (*AuthConfigurations, error)

NewAuthConfigurationsFromDockerCfg returns AuthConfigurations from system config files. The following files are checked in the order listed: - $DOCKER_CONFIG/config.json if DOCKER_CONFIG set in the environment, - $HOME/.docker/config.json - $HOME/.dockercfg

func NewAuthConfigurationsFromFile

func NewAuthConfigurationsFromFile(path string) (*AuthConfigurations, error)

NewAuthConfigurationsFromFile returns AuthConfigurations from a path containing JSON in the same format as the .dockercfg file.

type AuthConfigurations119

type AuthConfigurations119 map[string]AuthConfiguration

AuthConfigurations119 is used to serialize a set of AuthConfigurations for Docker API >= 1.19.

type AuthStatus

type AuthStatus struct {
	Status        string `json:"Status,omitempty" yaml:"Status,omitempty" toml:"Status,omitempty"`
	IdentityToken string `json:"IdentityToken,omitempty" yaml:"IdentityToken,omitempty" toml:"IdentityToken,omitempty"`
}

AuthStatus returns the authentication status for Docker API versions >= 1.23.

type BindOptions

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

BindOptions contains optional configuration for the bind type

type BlkioStatsEntry

type BlkioStatsEntry struct {
	Major uint64 `json:"major,omitempty" yaml:"major,omitempty" toml:"major,omitempty"`
	Minor uint64 `json:"minor,omitempty" yaml:"minor,omitempty" toml:"minor,omitempty"`
	Op    string `json:"op,omitempty" yaml:"op,omitempty" toml:"op,omitempty"`
	Value uint64 `json:"value,omitempty" yaml:"value,omitempty" toml:"value,omitempty"`
}

BlkioStatsEntry is a stats entry for blkio_stats

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 BuildArg

type BuildArg struct {
	Name  string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
	Value string `json:"Value,omitempty" yaml:"Value,omitempty" toml:"Value,omitempty"`
}

BuildArg represents arguments that can be passed to the image when building it from a Dockerfile.

For more details about the Docker building process, see https://goo.gl/4nYHwV.

type BuildImageOptions

type BuildImageOptions struct {
	Context             context.Context
	Name                string             `qs:"t"`
	Dockerfile          string             `qs:"dockerfile"`
	CacheFrom           []string           `qs:"-"`
	Memory              int64              `qs:"memory"`
	Memswap             int64              `qs:"memswap"`
	CPUShares           int64              `qs:"cpushares"`
	CPUQuota            int64              `qs:"cpuquota"`
	CPUPeriod           int64              `qs:"cpuperiod"`
	CPUSetCPUs          string             `qs:"cpusetcpus"`
	Labels              map[string]string  `qs:"labels"`
	InputStream         io.Reader          `qs:"-"`
	OutputStream        io.Writer          `qs:"-"`
	Remote              string             `qs:"remote"`
	Auth                AuthConfiguration  `qs:"-"` // for older docker X-Registry-Auth header
	AuthConfigs         AuthConfigurations `qs:"-"` // for newer docker X-Registry-Config header
	ContextDir          string             `qs:"-"`
	Ulimits             []ULimit           `qs:"-"`
	BuildArgs           []BuildArg         `qs:"-"`
	NetworkMode         string             `qs:"networkmode"`
	InactivityTimeout   time.Duration      `qs:"-"`
	CgroupParent        string             `qs:"cgroupparent"`
	SecurityOpt         []string           `qs:"securityopt"`
	Target              string             `gs:"target"`
	NoCache             bool               `qs:"nocache"`
	SuppressOutput      bool               `qs:"q"`
	Pull                bool               `qs:"pull"`
	RmTmpContainer      bool               `qs:"rm"`
	ForceRmTmpContainer bool               `qs:"forcerm"`
	RawJSONStream       bool               `qs:"-"`
}

BuildImageOptions present the set of informations available for building an image from a tarfile with a Dockerfile in it.

For more details about the Docker building process, see https://goo.gl/4nYHwV.

type CPUStats

type CPUStats struct {
	CPUUsage struct {
		PercpuUsage       []uint64 `json:"percpu_usage,omitempty" yaml:"percpu_usage,omitempty" toml:"percpu_usage,omitempty"`
		UsageInUsermode   uint64   `json:"usage_in_usermode,omitempty" yaml:"usage_in_usermode,omitempty" toml:"usage_in_usermode,omitempty"`
		TotalUsage        uint64   `json:"total_usage,omitempty" yaml:"total_usage,omitempty" toml:"total_usage,omitempty"`
		UsageInKernelmode uint64   `json:"usage_in_kernelmode,omitempty" yaml:"usage_in_kernelmode,omitempty" toml:"usage_in_kernelmode,omitempty"`
	} `json:"cpu_usage,omitempty" yaml:"cpu_usage,omitempty" toml:"cpu_usage,omitempty"`
	SystemCPUUsage uint64 `json:"system_cpu_usage,omitempty" yaml:"system_cpu_usage,omitempty" toml:"system_cpu_usage,omitempty"`
	OnlineCPUs     uint64 `json:"online_cpus,omitempty" yaml:"online_cpus,omitempty" toml:"online_cpus,omitempty"`
	ThrottlingData struct {
		Periods          uint64 `json:"periods,omitempty"`
		ThrottledPeriods uint64 `json:"throttled_periods,omitempty"`
		ThrottledTime    uint64 `json:"throttled_time,omitempty"`
	} `json:"throttling_data,omitempty" yaml:"throttling_data,omitempty" toml:"throttling_data,omitempty"`
}

CPUStats is a stats entry for cpu stats

type Change

type Change struct {
	Path string
	Kind ChangeType
}

Change represents a change in a container.

See https://goo.gl/Wo0JJp for more details.

func (*Change) String

func (change *Change) String() string

type ChangeType

type ChangeType int

ChangeType is a type for constants indicating the type of change in a container

const (
	// ChangeModify is the ChangeType for container modifications
	ChangeModify ChangeType = iota

	// ChangeAdd is the ChangeType for additions to a container
	ChangeAdd

	// ChangeDelete is the ChangeType for deletions from a container
	ChangeDelete
)

type Client

type Client struct {
	SkipServerVersionCheck bool
	HTTPClient             *http.Client
	TLSConfig              *tls.Config
	Dialer                 Dialer
	// contains filtered or unexported fields
}

Client is the basic type of this package. It provides methods for interaction with the API.

func NewClient

func NewClient(endpoint string) (*Client, error)

NewClient returns a Client instance ready for communication with the given server endpoint. It will use the latest remote API version available in the server.

func NewClientFromEnv

func NewClientFromEnv() (*Client, error)

NewClientFromEnv returns a Client instance ready for communication created from Docker's default logic for the environment variables DOCKER_HOST, DOCKER_TLS_VERIFY, and DOCKER_CERT_PATH.

See https://github.com/docker/docker/blob/1f963af697e8df3a78217f6fdbf67b8123a7db94/docker/docker.go#L68. See https://github.com/docker/compose/blob/81707ef1ad94403789166d2fe042c8a718a4c748/compose/cli/docker_client.py#L7.

func NewTLSClient

func NewTLSClient(endpoint string, cert, key, ca string) (*Client, error)

NewTLSClient returns a Client instance ready for TLS communications with the givens server endpoint, key and certificates . It will use the latest remote API version available in the server.

func NewTLSClientFromBytes

func NewTLSClientFromBytes(endpoint string, certPEMBlock, keyPEMBlock, caPEMCert []byte) (*Client, error)

NewTLSClientFromBytes returns a Client instance ready for TLS communications with the givens server endpoint, key and certificates (passed inline to the function as opposed to being read from a local file). It will use the latest remote API version available in the server.

func NewVersionedClient

func NewVersionedClient(endpoint string, apiVersionString string) (*Client, error)

NewVersionedClient returns a Client instance ready for communication with the given server endpoint, using a specific remote API version.

func NewVersionedClientFromEnv

func NewVersionedClientFromEnv(apiVersionString string) (*Client, error)

NewVersionedClientFromEnv returns a Client instance ready for TLS communications created from Docker's default logic for the environment variables DOCKER_HOST, DOCKER_TLS_VERIFY, and DOCKER_CERT_PATH, and using a specific remote API version.

See https://github.com/docker/docker/blob/1f963af697e8df3a78217f6fdbf67b8123a7db94/docker/docker.go#L68. See https://github.com/docker/compose/blob/81707ef1ad94403789166d2fe042c8a718a4c748/compose/cli/docker_client.py#L7.

func NewVersionedTLSClient

func NewVersionedTLSClient(endpoint string, cert, key, ca, apiVersionString string) (*Client, error)

NewVersionedTLSClient returns a Client instance ready for TLS communications with the givens server endpoint, key and certificates, using a specific remote API version.

func NewVersionedTLSClientFromBytes

func NewVersionedTLSClientFromBytes(endpoint string, certPEMBlock, keyPEMBlock, caPEMCert []byte, apiVersionString string) (*Client, error)

NewVersionedTLSClientFromBytes returns a Client instance ready for TLS communications with the givens server endpoint, key and certificates (passed inline to the function as opposed to being read from a local file), using a specific remote API version.

func NewVersionnedTLSClient deprecated

func NewVersionnedTLSClient(endpoint string, cert, key, ca, apiVersionString string) (*Client, error)

NewVersionnedTLSClient is like NewVersionedClient, but with ann extra n.

Deprecated: Use NewVersionedTLSClient instead.

func (*Client) AddEventListener

func (c *Client) AddEventListener(listener chan<- *APIEvents) error

AddEventListener adds a new listener to container events in the Docker API.

The parameter is a channel through which events will be sent.

Example
package main

import (
	"log"
	"time"

	docker "github.com/fsouza/go-dockerclient"
)

func main() {
	client, err := docker.NewClient("http://localhost:4243")
	if err != nil {
		log.Fatal(err)
	}

	listener := make(chan *docker.APIEvents)
	err = client.AddEventListener(listener)
	if err != nil {
		log.Fatal(err)
	}

	defer func() {

		err = client.RemoveEventListener(listener)
		if err != nil {
			log.Fatal(err)
		}

	}()

	timeout := time.After(1 * time.Second)

	for {
		select {
		case msg := <-listener:
			log.Println(msg)
		case <-timeout:
			return
		}
	}

}
Output:

func (*Client) AttachToContainer

func (c *Client) AttachToContainer(opts AttachToContainerOptions) error

AttachToContainer attaches to a container, using the given options.

See https://goo.gl/JF10Zk for more details.

Example
package main

import (
	"bytes"
	"log"

	docker "github.com/fsouza/go-dockerclient"
)

func main() {
	client, err := docker.NewClient("http://localhost:4243")
	if err != nil {
		log.Fatal(err)
	}
	client.SkipServerVersionCheck = true
	// Reading logs from container a84849 and sending them to buf.
	var buf bytes.Buffer
	err = client.AttachToContainer(docker.AttachToContainerOptions{
		Container:    "a84849",
		OutputStream: &buf,
		Logs:         true,
		Stdout:       true,
		Stderr:       true,
	})
	if err != nil {
		log.Fatal(err)
	}
	log.Println(buf.String())
	buf.Reset()
	err = client.AttachToContainer(docker.AttachToContainerOptions{
		Container:    "a84849",
		OutputStream: &buf,
		Stdout:       true,
		Stream:       true,
	})
	if err != nil {
		log.Fatal(err)
	}
	log.Println(buf.String())
}
Output:

func (*Client) AttachToContainerNonBlocking

func (c *Client) AttachToContainerNonBlocking(opts AttachToContainerOptions) (CloseWaiter, error)

AttachToContainerNonBlocking attaches to a container, using the given options. This function does not block.

See https://goo.gl/NKpkFk for more details.

func (*Client) AuthCheck

func (c *Client) AuthCheck(conf *AuthConfiguration) (AuthStatus, error)

AuthCheck validates the given credentials. It returns nil if successful.

For Docker API versions >= 1.23, the AuthStatus struct will be populated, otherwise it will be empty.`

See https://goo.gl/6nsZkH for more details.

func (*Client) BuildImage

func (c *Client) BuildImage(opts BuildImageOptions) error

BuildImage builds an image from a tarball's url or a Dockerfile in the input stream.

See https://goo.gl/4nYHwV for more details.

Example
package main

import (
	"archive/tar"
	"bytes"
	"log"
	"time"

	docker "github.com/fsouza/go-dockerclient"
)

func main() {
	client, err := docker.NewClient("http://localhost:4243")
	if err != nil {
		log.Fatal(err)
	}

	t := time.Now()
	inputbuf, outputbuf := bytes.NewBuffer(nil), bytes.NewBuffer(nil)
	tr := tar.NewWriter(inputbuf)
	tr.WriteHeader(&tar.Header{Name: "Dockerfile", Size: 10, ModTime: t, AccessTime: t, ChangeTime: t})
	tr.Write([]byte("FROM base\n"))
	tr.Close()
	opts := docker.BuildImageOptions{
		Name:         "test",
		InputStream:  inputbuf,
		OutputStream: outputbuf,
	}
	if err := client.BuildImage(opts); err != nil {
		log.Fatal(err)
	}
}
Output:

func (*Client) CommitContainer

func (c *Client) CommitContainer(opts CommitContainerOptions) (*Image, error)

CommitContainer creates a new image from a container's changes.

See https://goo.gl/CzIguf for more details.

func (*Client) ConfigurePlugin added in v1.2.0

func (c *Client) ConfigurePlugin(opts ConfigurePluginOptions) error

ConfigurePlugin configures plugin that opts point or returns an error.

See https://goo.gl/C4t7Tz for more details.

func (*Client) ConnectNetwork

func (c *Client) ConnectNetwork(id string, opts NetworkConnectionOptions) error

ConnectNetwork adds a container to a network or returns an error in case of failure.

See https://goo.gl/6GugX3 for more details.

func (*Client) ContainerChanges

func (c *Client) ContainerChanges(id string) ([]Change, error)

ContainerChanges returns changes in the filesystem of the given container.

See https://goo.gl/15KKzh for more details.

func (*Client) CopyFromContainer deprecated

func (c *Client) CopyFromContainer(opts CopyFromContainerOptions) error

CopyFromContainer copies files from a container.

Deprecated: Use DownloadFromContainer and DownloadFromContainer instead.

func (*Client) CreateConfig added in v1.1.0

func (c *Client) CreateConfig(opts CreateConfigOptions) (*swarm.Config, error)

CreateConfig creates a new config, returning the config instance or an error in case of failure.

See https://goo.gl/KrVjHz for more details.

func (*Client) CreateContainer

func (c *Client) CreateContainer(opts CreateContainerOptions) (*Container, error)

CreateContainer creates a new container, returning the container instance, or an error in case of failure.

The returned container instance contains only the container ID. To get more details about the container after creating it, use InspectContainer.

See https://goo.gl/tyzwVM for more details.

func (*Client) CreateExec

func (c *Client) CreateExec(opts CreateExecOptions) (*Exec, error)

CreateExec sets up an exec instance in a running container `id`, returning the exec instance, or an error in case of failure.

See https://goo.gl/60TeBP for more details

func (*Client) CreateNetwork

func (c *Client) CreateNetwork(opts CreateNetworkOptions) (*Network, error)

CreateNetwork creates a new network, returning the network instance, or an error in case of failure.

See https://goo.gl/6GugX3 for more details.

func (*Client) CreatePlugin added in v1.2.0

func (c *Client) CreatePlugin(opts CreatePluginOptions) (string, error)

CreatePlugin creates plugin that opts point or returns an error.

See https://goo.gl/C4t7Tz for more details.

func (*Client) CreateSecret added in v1.1.0

func (c *Client) CreateSecret(opts CreateSecretOptions) (*swarm.Secret, error)

CreateSecret creates a new secret, returning the secret instance or an error in case of failure.

See https://goo.gl/KrVjHz for more details.

func (*Client) CreateService

func (c *Client) CreateService(opts CreateServiceOptions) (*swarm.Service, error)

CreateService creates a new service, returning the service instance or an error in case of failure.

See https://goo.gl/KrVjHz for more details.

func (*Client) CreateVolume

func (c *Client) CreateVolume(opts CreateVolumeOptions) (*Volume, error)

CreateVolume creates a volume on the server.

See https://goo.gl/qEhmEC for more details.

func (*Client) DisablePlugin added in v1.2.0

func (c *Client) DisablePlugin(opts DisablePluginOptions) error

DisablePlugin disables plugin that opts point or returns an error.

See https://goo.gl/C4t7Tz for more details.

func (*Client) DisconnectNetwork

func (c *Client) DisconnectNetwork(id string, opts NetworkConnectionOptions) error

DisconnectNetwork removes a container from a network or returns an error in case of failure.

See https://goo.gl/6GugX3 for more details.

func (*Client) DiskUsage added in v1.3.7

func (c *Client) DiskUsage(opts DiskUsageOptions) (*DiskUsage, error)

DiskUsage returns a *DiskUsage describing what docker is using disk on.

More Info Here https://dockr.ly/2PNzQyO

func (*Client) DownloadFromContainer

func (c *Client) DownloadFromContainer(id string, opts DownloadFromContainerOptions) error

DownloadFromContainer downloads a tar archive of files or folders in a container.

See https://goo.gl/W49jxK for more details.

func (*Client) EnablePlugin added in v1.2.0

func (c *Client) EnablePlugin(opts EnablePluginOptions) error

EnablePlugin enables plugin that opts point or returns an error.

See https://goo.gl/C4t7Tz for more details.

func (*Client) Endpoint

func (c *Client) Endpoint() string

Endpoint returns the current endpoint. It's useful for getting the endpoint when using functions that get this data from the environment (like NewClientFromEnv.

func (*Client) ExportContainer

func (c *Client) ExportContainer(opts ExportContainerOptions) error

ExportContainer export the contents of container id as tar archive and prints the exported contents to stdout.

See https://goo.gl/yGJCIh for more details.

func (*Client) ExportImage

func (c *Client) ExportImage(opts ExportImageOptions) error

ExportImage exports an image (as a tar file) into the stream.

See https://goo.gl/AuySaA for more details.

func (*Client) ExportImages

func (c *Client) ExportImages(opts ExportImagesOptions) error

ExportImages exports one or more images (as a tar file) into the stream

See https://goo.gl/N9XlDn for more details.

func (*Client) FilteredListNetworks

func (c *Client) FilteredListNetworks(opts NetworkFilterOpts) ([]Network, error)

FilteredListNetworks returns all networks with the filters applied

See goo.gl/zd2mx4 for more details.

func (*Client) GetPluginPrivileges added in v1.2.0

func (c *Client) GetPluginPrivileges(name string, ctx context.Context) ([]PluginPrivilege, error)

GetPluginPrivileges returns pulginPrivileges or an error.

See https://goo.gl/C4t7Tz for more details.

func (*Client) GetServiceLogs

func (c *Client) GetServiceLogs(opts LogsServiceOptions) error

GetServiceLogs gets stdout and stderr logs from the specified service.

When LogsServiceOptions.RawTerminal is set to false, go-dockerclient will multiplex the streams and send the containers stdout to LogsServiceOptions.OutputStream, and stderr to LogsServiceOptions.ErrorStream.

When LogsServiceOptions.RawTerminal is true, callers will get the raw stream on LogsServiceOptions.OutputStream.

func (*Client) ImageHistory

func (c *Client) ImageHistory(name string) ([]ImageHistory, error)

ImageHistory returns the history of the image by its name or ID.

See https://goo.gl/fYtxQa for more details.

func (*Client) ImportImage

func (c *Client) ImportImage(opts ImportImageOptions) error

ImportImage imports an image from a url, a file or stdin

See https://goo.gl/qkoSsn for more details.

func (*Client) Info

func (c *Client) Info() (*DockerInfo, error)

Info returns system-wide information about the Docker server.

See https://goo.gl/ElTHi2 for more details.

func (*Client) InitSwarm

func (c *Client) InitSwarm(opts InitSwarmOptions) (string, error)

InitSwarm initializes a new Swarm and returns the node ID. See https://goo.gl/ZWyG1M for more details.

func (*Client) InspectConfig added in v1.1.0

func (c *Client) InspectConfig(id string) (*swarm.Config, error)

InspectConfig returns information about a config by its ID.

See https://goo.gl/dHmr75 for more details.

func (*Client) InspectContainer

func (c *Client) InspectContainer(id string) (*Container, error)

InspectContainer returns information about a container by its ID.

See https://goo.gl/FaI5JT for more details.

func (*Client) InspectContainerWithContext

func (c *Client) InspectContainerWithContext(id string, ctx context.Context) (*Container, error)

InspectContainerWithContext returns information about a container by its ID. The context object can be used to cancel the inspect request.

See https://goo.gl/FaI5JT for more details.

func (*Client) InspectDistribution

func (c *Client) InspectDistribution(name string) (*registry.DistributionInspect, error)

InspectDistribution returns image digest and platform information by contacting the registry

func (*Client) InspectExec

func (c *Client) InspectExec(id string) (*ExecInspect, error)

InspectExec returns low-level information about the exec command id.

See https://goo.gl/ctMUiW for more details

func (*Client) InspectImage

func (c *Client) InspectImage(name string) (*Image, error)

InspectImage returns an image by its name or ID.

See https://goo.gl/ncLTG8 for more details.

func (*Client) InspectNode

func (c *Client) InspectNode(id string) (*swarm.Node, error)

InspectNode returns information about a node by its ID.

See http://goo.gl/WjkTOk for more details.

func (*Client) InspectPlugins added in v1.2.0

func (c *Client) InspectPlugins(name string, ctx context.Context) (*PluginDetail, error)

InspectPlugins returns a pluginDetail or an error.

See https://goo.gl/C4t7Tz for more details.

func (*Client) InspectSecret added in v1.1.0

func (c *Client) InspectSecret(id string) (*swarm.Secret, error)

InspectSecret returns information about a secret by its ID.

See https://goo.gl/dHmr75 for more details.

func (*Client) InspectService

func (c *Client) InspectService(id string) (*swarm.Service, error)

InspectService returns information about a service by its ID.

See https://goo.gl/dHmr75 for more details.

func (*Client) InspectSwarm

func (c *Client) InspectSwarm(ctx context.Context) (swarm.Swarm, error)

InspectSwarm inspects a Swarm. See https://goo.gl/MFwgX9 for more details.

func (*Client) InspectTask

func (c *Client) InspectTask(id string) (*swarm.Task, error)

InspectTask returns information about a task by its ID.

See http://goo.gl/kyziuq for more details.

func (*Client) InspectVolume

func (c *Client) InspectVolume(name string) (*Volume, error)

InspectVolume returns a volume by its name.

See https://goo.gl/GMjsMc for more details.

func (*Client) InstallPlugins added in v1.2.0

func (c *Client) InstallPlugins(opts InstallPluginOptions) error

InstallPlugins installs a plugin or returns an error in case of failure.

See https://goo.gl/C4t7Tz for more details.

func (*Client) JoinSwarm

func (c *Client) JoinSwarm(opts JoinSwarmOptions) error

JoinSwarm joins an existing Swarm. See https://goo.gl/N59IP1 for more details.

func (*Client) KillContainer

func (c *Client) KillContainer(opts KillContainerOptions) error

KillContainer sends a signal to a container, returning an error in case of failure.

See https://goo.gl/JnTxXZ for more details.

func (*Client) LeaveSwarm

func (c *Client) LeaveSwarm(opts LeaveSwarmOptions) error

LeaveSwarm leaves a Swarm. See https://goo.gl/FTX1aD for more details.

func (*Client) ListConfigs added in v1.1.0

func (c *Client) ListConfigs(opts ListConfigsOptions) ([]swarm.Config, error)

ListConfigs returns a slice of configs matching the given criteria.

See https://goo.gl/DwvNMd for more details.

func (*Client) ListContainers

func (c *Client) ListContainers(opts ListContainersOptions) ([]APIContainers, error)

ListContainers returns a slice of containers matching the given criteria.

See https://goo.gl/kaOHGw for more details.

func (*Client) ListFilteredPlugins added in v1.2.1

func (c *Client) ListFilteredPlugins(opts ListFilteredPluginsOptions) ([]PluginDetail, error)

ListFilteredPlugins returns pluginDetails or an error.

See https://goo.gl/rmdmWg for more details.

func (*Client) ListImages

func (c *Client) ListImages(opts ListImagesOptions) ([]APIImages, error)

ListImages returns the list of available images in the server.

See https://goo.gl/BVzauZ for more details.

func (*Client) ListNetworks

func (c *Client) ListNetworks() ([]Network, error)

ListNetworks returns all networks.

See https://goo.gl/6GugX3 for more details.

func (*Client) ListNodes

func (c *Client) ListNodes(opts ListNodesOptions) ([]swarm.Node, error)

ListNodes returns a slice of nodes matching the given criteria.

See http://goo.gl/3K4GwU for more details.

func (*Client) ListPlugins added in v1.2.0

func (c *Client) ListPlugins(ctx context.Context) ([]PluginDetail, error)

ListPlugins returns pluginDetails or an error.

See https://goo.gl/C4t7Tz for more details.

func (*Client) ListSecrets added in v1.1.0

func (c *Client) ListSecrets(opts ListSecretsOptions) ([]swarm.Secret, error)

ListSecrets returns a slice of secrets matching the given criteria.

See https://goo.gl/DwvNMd for more details.

func (*Client) ListServices

func (c *Client) ListServices(opts ListServicesOptions) ([]swarm.Service, error)

ListServices returns a slice of services matching the given criteria.

See https://goo.gl/DwvNMd for more details.

func (*Client) ListTasks

func (c *Client) ListTasks(opts ListTasksOptions) ([]swarm.Task, error)

ListTasks returns a slice of tasks matching the given criteria.

See http://goo.gl/rByLzw for more details.

func (*Client) ListVolumes

func (c *Client) ListVolumes(opts ListVolumesOptions) ([]Volume, error)

ListVolumes returns a list of available volumes in the server.

See https://goo.gl/3wgTsd for more details.

func (*Client) LoadImage

func (c *Client) LoadImage(opts LoadImageOptions) error

LoadImage imports a tarball docker image

See https://goo.gl/rEsBV3 for more details.

func (*Client) Logs

func (c *Client) Logs(opts LogsOptions) error

Logs gets stdout and stderr logs from the specified container.

When LogsOptions.RawTerminal is set to false, go-dockerclient will multiplex the streams and send the containers stdout to LogsOptions.OutputStream, and stderr to LogsOptions.ErrorStream.

When LogsOptions.RawTerminal is true, callers will get the raw stream on LogsOptions.OutputStream. The caller can use libraries such as dlog (github.com/ahmetalpbalkan/dlog).

See https://goo.gl/krK0ZH for more details.

func (*Client) NetworkInfo

func (c *Client) NetworkInfo(id string) (*Network, error)

NetworkInfo returns information about a network by its ID.

See https://goo.gl/6GugX3 for more details.

func (*Client) PauseContainer

func (c *Client) PauseContainer(id string) error

PauseContainer pauses the given container.

See https://goo.gl/D1Yaii for more details.

func (*Client) Ping

func (c *Client) Ping() error

Ping pings the docker server

See https://goo.gl/wYfgY1 for more details.

func (*Client) PingWithContext

func (c *Client) PingWithContext(ctx context.Context) error

PingWithContext pings the docker server The context object can be used to cancel the ping request.

See https://goo.gl/wYfgY1 for more details.

func (*Client) PruneContainers

func (c *Client) PruneContainers(opts PruneContainersOptions) (*PruneContainersResults, error)

PruneContainers deletes containers which are stopped.

See https://goo.gl/wnkgDT for more details.

func (*Client) PruneImages

func (c *Client) PruneImages(opts PruneImagesOptions) (*PruneImagesResults, error)

PruneImages deletes images which are unused.

See https://goo.gl/qfZlbZ for more details.

func (*Client) PruneNetworks

func (c *Client) PruneNetworks(opts PruneNetworksOptions) (*PruneNetworksResults, error)

PruneNetworks deletes networks which are unused.

See https://goo.gl/kX0S9h for more details.

func (*Client) PruneVolumes

func (c *Client) PruneVolumes(opts PruneVolumesOptions) (*PruneVolumesResults, error)

PruneVolumes deletes volumes which are unused.

See https://goo.gl/f9XDem for more details.

func (*Client) PullImage

func (c *Client) PullImage(opts PullImageOptions, auth AuthConfiguration) error

PullImage pulls an image from a remote registry, logging progress to opts.OutputStream.

See https://goo.gl/qkoSsn for more details.

func (*Client) PushImage

func (c *Client) PushImage(opts PushImageOptions, auth AuthConfiguration) error

PushImage pushes an image to a remote registry, logging progress to w.

An empty instance of AuthConfiguration may be used for unauthenticated pushes.

See https://goo.gl/BZemGg for more details.

func (*Client) PushPlugin added in v1.2.0

func (c *Client) PushPlugin(opts PushPluginOptions) error

PushPlugin pushes plugin that opts point or returns an error.

See https://goo.gl/C4t7Tz for more details.

func (*Client) RemoveConfig added in v1.1.0

func (c *Client) RemoveConfig(opts RemoveConfigOptions) error

RemoveConfig removes a config, returning an error in case of failure.

See https://goo.gl/Tqrtya for more details.

func (*Client) RemoveContainer

func (c *Client) RemoveContainer(opts RemoveContainerOptions) error

RemoveContainer removes a container, returning an error in case of failure.

See https://goo.gl/hL5IPC for more details.

func (*Client) RemoveEventListener

func (c *Client) RemoveEventListener(listener chan *APIEvents) error

RemoveEventListener removes a listener from the monitor.

func (*Client) RemoveImage

func (c *Client) RemoveImage(name string) error

RemoveImage removes an image by its name or ID.

See https://goo.gl/Vd2Pck for more details.

func (*Client) RemoveImageExtended

func (c *Client) RemoveImageExtended(name string, opts RemoveImageOptions) error

RemoveImageExtended removes an image by its name or ID. Extra params can be passed, see RemoveImageOptions

See https://goo.gl/Vd2Pck for more details.

func (*Client) RemoveNetwork

func (c *Client) RemoveNetwork(id string) error

RemoveNetwork removes a network or returns an error in case of failure.

See https://goo.gl/6GugX3 for more details.

func (*Client) RemoveNode

func (c *Client) RemoveNode(opts RemoveNodeOptions) error

RemoveNode removes a node.

See http://goo.gl/0SNvYg for more details.

func (*Client) RemovePlugin added in v1.2.0

func (c *Client) RemovePlugin(opts RemovePluginOptions) (*PluginDetail, error)

RemovePlugin returns a PluginDetail or an error.

See https://goo.gl/C4t7Tz for more details.

func (*Client) RemoveSecret added in v1.1.0

func (c *Client) RemoveSecret(opts RemoveSecretOptions) error

RemoveSecret removes a secret, returning an error in case of failure.

See https://goo.gl/Tqrtya for more details.

func (*Client) RemoveService

func (c *Client) RemoveService(opts RemoveServiceOptions) error

RemoveService removes a service, returning an error in case of failure.

See https://goo.gl/Tqrtya for more details.

func (*Client) RemoveVolume deprecated

func (c *Client) RemoveVolume(name string) error

RemoveVolume removes a volume by its name.

Deprecated: Use RemoveVolumeWithOptions instead.

func (*Client) RemoveVolumeWithOptions added in v1.2.1

func (c *Client) RemoveVolumeWithOptions(opts RemoveVolumeOptions) error

RemoveVolumeWithOptions removes a volume by its name and takes extra parameters.

See https://goo.gl/nvd6qj for more details.

func (*Client) RenameContainer

func (c *Client) RenameContainer(opts RenameContainerOptions) error

RenameContainer updates and existing containers name

See https://goo.gl/46inai for more details.

func (*Client) ResizeContainerTTY

func (c *Client) ResizeContainerTTY(id string, height, width int) error

ResizeContainerTTY resizes the terminal to the given height and width.

See https://goo.gl/FImjeq for more details.

func (*Client) ResizeExecTTY

func (c *Client) ResizeExecTTY(id string, height, width int) error

ResizeExecTTY resizes the tty session used by the exec command id. This API is valid only if Tty was specified as part of creating and starting the exec command.

See https://goo.gl/Mo5bxx for more details

func (*Client) RestartContainer

func (c *Client) RestartContainer(id string, timeout uint) error

RestartContainer stops a container, killing it after the given timeout (in seconds), during the stop process.

See https://goo.gl/MrAKQ5 for more details.

func (*Client) SearchImages

func (c *Client) SearchImages(term string) ([]APIImageSearch, error)

SearchImages search the docker hub with a specific given term.

See https://goo.gl/KLO9IZ for more details.

func (*Client) SearchImagesEx

func (c *Client) SearchImagesEx(term string, auth AuthConfiguration) ([]APIImageSearch, error)

SearchImagesEx search the docker hub with a specific given term and authentication.

See https://goo.gl/KLO9IZ for more details.

func (*Client) ServerAPIVersion added in v1.3.7

func (c *Client) ServerAPIVersion() string

func (*Client) SetTimeout

func (c *Client) SetTimeout(t time.Duration)

SetTimeout takes a timeout and applies it to the HTTPClient. It should not be called concurrently with any other Client methods.

func (*Client) StartContainer

func (c *Client) StartContainer(id string, hostConfig *HostConfig) error

StartContainer starts a container, returning an error in case of failure.

Passing the HostConfig to this method has been deprecated in Docker API 1.22 (Docker Engine 1.10.x) and totally removed in Docker API 1.24 (Docker Engine 1.12.x). The client will ignore the parameter when communicating with Docker API 1.24 or greater.

See https://goo.gl/fbOSZy for more details.

func (*Client) StartContainerWithContext

func (c *Client) StartContainerWithContext(id string, hostConfig *HostConfig, ctx context.Context) error

StartContainerWithContext starts a container, returning an error in case of failure. The context can be used to cancel the outstanding start container request.

Passing the HostConfig to this method has been deprecated in Docker API 1.22 (Docker Engine 1.10.x) and totally removed in Docker API 1.24 (Docker Engine 1.12.x). The client will ignore the parameter when communicating with Docker API 1.24 or greater.

See https://goo.gl/fbOSZy for more details.

func (*Client) StartExec

func (c *Client) StartExec(id string, opts StartExecOptions) error

StartExec starts a previously set up exec instance id. If opts.Detach is true, it returns after starting the exec command. Otherwise, it sets up an interactive session with the exec command.

See https://goo.gl/1EeDWi for more details

func (*Client) StartExecNonBlocking

func (c *Client) StartExecNonBlocking(id string, opts StartExecOptions) (CloseWaiter, error)

StartExecNonBlocking starts a previously set up exec instance id. If opts.Detach is true, it returns after starting the exec command. Otherwise, it sets up an interactive session with the exec command.

See https://goo.gl/1EeDWi for more details

func (*Client) Stats

func (c *Client) Stats(opts StatsOptions) (retErr error)

Stats sends container statistics for the given container to the given channel.

This function is blocking, similar to a streaming call for logs, and should be run on a separate goroutine from the caller. Note that this function will block until the given container is removed, not just exited. When finished, this function will close the given channel. Alternatively, function can be stopped by signaling on the Done channel.

See https://goo.gl/Dk3Xio for more details.

func (*Client) StopContainer

func (c *Client) StopContainer(id string, timeout uint) error

StopContainer stops a container, killing it after the given timeout (in seconds).

See https://goo.gl/R9dZcV for more details.

func (*Client) StopContainerWithContext

func (c *Client) StopContainerWithContext(id string, timeout uint, ctx context.Context) error

StopContainerWithContext stops a container, killing it after the given timeout (in seconds). The context can be used to cancel the stop container request.

See https://goo.gl/R9dZcV for more details.

func (*Client) TagImage

func (c *Client) TagImage(name string, opts TagImageOptions) error

TagImage adds a tag to the image identified by the given name.

See https://goo.gl/prHrvo for more details.

func (*Client) TopContainer

func (c *Client) TopContainer(id string, psArgs string) (TopResult, error)

TopContainer returns processes running inside a container

See https://goo.gl/FLwpPl for more details.

func (*Client) UnpauseContainer

func (c *Client) UnpauseContainer(id string) error

UnpauseContainer unpauses the given container.

See https://goo.gl/sZ2faO for more details.

func (*Client) UpdateConfig added in v1.1.0

func (c *Client) UpdateConfig(id string, opts UpdateConfigOptions) error

UpdateConfig updates the config at ID with the options

Only label can be updated https://docs.docker.com/engine/api/v1.33/#operation/ConfigUpdate See https://goo.gl/wu3MmS for more details.

func (*Client) UpdateContainer

func (c *Client) UpdateContainer(id string, opts UpdateContainerOptions) error

UpdateContainer updates the container at ID with the options

See https://goo.gl/Y6fXUy for more details.

func (*Client) UpdateNode

func (c *Client) UpdateNode(id string, opts UpdateNodeOptions) error

UpdateNode updates a node.

See http://goo.gl/VPBFgA for more details.

func (*Client) UpdateSecret added in v1.1.0

func (c *Client) UpdateSecret(id string, opts UpdateSecretOptions) error

UpdateSecret updates the secret at ID with the options

See https://goo.gl/wu3MmS for more details.

func (*Client) UpdateService

func (c *Client) UpdateService(id string, opts UpdateServiceOptions) error

UpdateService updates the service at ID with the options

See https://goo.gl/wu3MmS for more details.

func (*Client) UpdateSwarm

func (c *Client) UpdateSwarm(opts UpdateSwarmOptions) error

UpdateSwarm updates a Swarm. See https://goo.gl/iJFnsw for more details.

func (*Client) UploadToContainer

func (c *Client) UploadToContainer(id string, opts UploadToContainerOptions) error

UploadToContainer uploads a tar archive to be extracted to a path in the filesystem of the container.

See https://goo.gl/g25o7u for more details.

func (*Client) Version

func (c *Client) Version() (*Env, error)

Version returns version information about the docker server.

See https://goo.gl/mU7yje for more details.

func (*Client) VersionWithContext added in v1.2.1

func (c *Client) VersionWithContext(ctx context.Context) (*Env, error)

VersionWithContext returns version information about the docker server.

func (*Client) WaitContainer

func (c *Client) WaitContainer(id string) (int, error)

WaitContainer blocks until the given container stops, return the exit code of the container status.

See https://goo.gl/4AGweZ for more details.

func (*Client) WaitContainerWithContext

func (c *Client) WaitContainerWithContext(id string, ctx context.Context) (int, error)

WaitContainerWithContext blocks until the given container stops, return the exit code of the container status. The context object can be used to cancel the inspect request.

See https://goo.gl/4AGweZ for more details.

func (*Client) WithTransport added in v1.2.0

func (c *Client) WithTransport(trFunc func() *http.Transport)

WithTransport replaces underlying HTTP client of Docker Client by accepting a function that returns pointer to a transport object.

type CloseWaiter

type CloseWaiter interface {
	io.Closer
	Wait() error
}

CloseWaiter is an interface with methods for closing the underlying resource and then waiting for it to finish processing.

type CommitContainerOptions

type CommitContainerOptions struct {
	Container  string
	Repository string `qs:"repo"`
	Tag        string
	Message    string `qs:"comment"`
	Author     string
	Changes    []string `qs:"changes"`
	Run        *Config  `qs:"-"`
	Context    context.Context
}

CommitContainerOptions aggregates parameters to the CommitContainer method.

See https://goo.gl/CzIguf for more details.

type Config

type Config struct {
	Hostname          string              `json:"Hostname,omitempty" yaml:"Hostname,omitempty" toml:"Hostname,omitempty"`
	Domainname        string              `json:"Domainname,omitempty" yaml:"Domainname,omitempty" toml:"Domainname,omitempty"`
	User              string              `json:"User,omitempty" yaml:"User,omitempty" toml:"User,omitempty"`
	Memory            int64               `json:"Memory,omitempty" yaml:"Memory,omitempty" toml:"Memory,omitempty"`
	MemorySwap        int64               `json:"MemorySwap,omitempty" yaml:"MemorySwap,omitempty" toml:"MemorySwap,omitempty"`
	MemoryReservation int64               `json:"MemoryReservation,omitempty" yaml:"MemoryReservation,omitempty" toml:"MemoryReservation,omitempty"`
	KernelMemory      int64               `json:"KernelMemory,omitempty" yaml:"KernelMemory,omitempty" toml:"KernelMemory,omitempty"`
	CPUShares         int64               `json:"CpuShares,omitempty" yaml:"CpuShares,omitempty" toml:"CpuShares,omitempty"`
	CPUSet            string              `json:"Cpuset,omitempty" yaml:"Cpuset,omitempty" toml:"Cpuset,omitempty"`
	PortSpecs         []string            `json:"PortSpecs,omitempty" yaml:"PortSpecs,omitempty" toml:"PortSpecs,omitempty"`
	ExposedPorts      map[Port]struct{}   `json:"ExposedPorts,omitempty" yaml:"ExposedPorts,omitempty" toml:"ExposedPorts,omitempty"`
	PublishService    string              `json:"PublishService,omitempty" yaml:"PublishService,omitempty" toml:"PublishService,omitempty"`
	StopSignal        string              `json:"StopSignal,omitempty" yaml:"StopSignal,omitempty" toml:"StopSignal,omitempty"`
	StopTimeout       int                 `json:"StopTimeout,omitempty" yaml:"StopTimeout,omitempty" toml:"StopTimeout,omitempty"`
	Env               []string            `json:"Env,omitempty" yaml:"Env,omitempty" toml:"Env,omitempty"`
	Cmd               []string            `json:"Cmd" yaml:"Cmd" toml:"Cmd"`
	Shell             []string            `json:"Shell,omitempty" yaml:"Shell,omitempty" toml:"Shell,omitempty"`
	Healthcheck       *HealthConfig       `json:"Healthcheck,omitempty" yaml:"Healthcheck,omitempty" toml:"Healthcheck,omitempty"`
	DNS               []string            `json:"Dns,omitempty" yaml:"Dns,omitempty" toml:"Dns,omitempty"` // For Docker API v1.9 and below only
	Image             string              `json:"Image,omitempty" yaml:"Image,omitempty" toml:"Image,omitempty"`
	Volumes           map[string]struct{} `json:"Volumes,omitempty" yaml:"Volumes,omitempty" toml:"Volumes,omitempty"`
	VolumeDriver      string              `json:"VolumeDriver,omitempty" yaml:"VolumeDriver,omitempty" toml:"VolumeDriver,omitempty"`
	WorkingDir        string              `json:"WorkingDir,omitempty" yaml:"WorkingDir,omitempty" toml:"WorkingDir,omitempty"`
	MacAddress        string              `json:"MacAddress,omitempty" yaml:"MacAddress,omitempty" toml:"MacAddress,omitempty"`
	Entrypoint        []string            `json:"Entrypoint" yaml:"Entrypoint" toml:"Entrypoint"`
	SecurityOpts      []string            `json:"SecurityOpts,omitempty" yaml:"SecurityOpts,omitempty" toml:"SecurityOpts,omitempty"`
	OnBuild           []string            `json:"OnBuild,omitempty" yaml:"OnBuild,omitempty" toml:"OnBuild,omitempty"`
	Mounts            []Mount             `json:"Mounts,omitempty" yaml:"Mounts,omitempty" toml:"Mounts,omitempty"`
	Labels            map[string]string   `json:"Labels,omitempty" yaml:"Labels,omitempty" toml:"Labels,omitempty"`
	AttachStdin       bool                `json:"AttachStdin,omitempty" yaml:"AttachStdin,omitempty" toml:"AttachStdin,omitempty"`
	AttachStdout      bool                `json:"AttachStdout,omitempty" yaml:"AttachStdout,omitempty" toml:"AttachStdout,omitempty"`
	AttachStderr      bool                `json:"AttachStderr,omitempty" yaml:"AttachStderr,omitempty" toml:"AttachStderr,omitempty"`
	ArgsEscaped       bool                `json:"ArgsEscaped,omitempty" yaml:"ArgsEscaped,omitempty" toml:"ArgsEscaped,omitempty"`
	Tty               bool                `json:"Tty,omitempty" yaml:"Tty,omitempty" toml:"Tty,omitempty"`
	OpenStdin         bool                `json:"OpenStdin,omitempty" yaml:"OpenStdin,omitempty" toml:"OpenStdin,omitempty"`
	StdinOnce         bool                `json:"StdinOnce,omitempty" yaml:"StdinOnce,omitempty" toml:"StdinOnce,omitempty"`
	NetworkDisabled   bool                `json:"NetworkDisabled,omitempty" yaml:"NetworkDisabled,omitempty" toml:"NetworkDisabled,omitempty"`

	// This is no longer used and has been kept here for backward
	// compatibility, please use HostConfig.VolumesFrom.
	VolumesFrom string `json:"VolumesFrom,omitempty" yaml:"VolumesFrom,omitempty" toml:"VolumesFrom,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 ConfigurePluginOptions added in v1.2.0

type ConfigurePluginOptions struct {
	// The Name of the plugin.
	Name string `qs:"name"`
	Envs []string

	Context context.Context
}

ConfigurePluginOptions specify parameters to the ConfigurePlugin

See https://goo.gl/C4t7Tz for more details.

type Container

type Container struct {
	ID string `json:"Id" yaml:"Id" toml:"Id"`

	Created time.Time `json:"Created,omitempty" yaml:"Created,omitempty" toml:"Created,omitempty"`

	Path string   `json:"Path,omitempty" yaml:"Path,omitempty" toml:"Path,omitempty"`
	Args []string `json:"Args,omitempty" yaml:"Args,omitempty" toml:"Args,omitempty"`

	Config *Config `json:"Config,omitempty" yaml:"Config,omitempty" toml:"Config,omitempty"`
	State  State   `json:"State,omitempty" yaml:"State,omitempty" toml:"State,omitempty"`
	Image  string  `json:"Image,omitempty" yaml:"Image,omitempty" toml:"Image,omitempty"`

	Node *SwarmNode `json:"Node,omitempty" yaml:"Node,omitempty" toml:"Node,omitempty"`

	NetworkSettings *NetworkSettings `json:"NetworkSettings,omitempty" yaml:"NetworkSettings,omitempty" toml:"NetworkSettings,omitempty"`

	SysInitPath    string  `json:"SysInitPath,omitempty" yaml:"SysInitPath,omitempty" toml:"SysInitPath,omitempty"`
	ResolvConfPath string  `json:"ResolvConfPath,omitempty" yaml:"ResolvConfPath,omitempty" toml:"ResolvConfPath,omitempty"`
	HostnamePath   string  `json:"HostnamePath,omitempty" yaml:"HostnamePath,omitempty" toml:"HostnamePath,omitempty"`
	HostsPath      string  `json:"HostsPath,omitempty" yaml:"HostsPath,omitempty" toml:"HostsPath,omitempty"`
	LogPath        string  `json:"LogPath,omitempty" yaml:"LogPath,omitempty" toml:"LogPath,omitempty"`
	Name           string  `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
	Driver         string  `json:"Driver,omitempty" yaml:"Driver,omitempty" toml:"Driver,omitempty"`
	Mounts         []Mount `json:"Mounts,omitempty" yaml:"Mounts,omitempty" toml:"Mounts,omitempty"`

	Volumes     map[string]string `json:"Volumes,omitempty" yaml:"Volumes,omitempty" toml:"Volumes,omitempty"`
	VolumesRW   map[string]bool   `json:"VolumesRW,omitempty" yaml:"VolumesRW,omitempty" toml:"VolumesRW,omitempty"`
	HostConfig  *HostConfig       `json:"HostConfig,omitempty" yaml:"HostConfig,omitempty" toml:"HostConfig,omitempty"`
	ExecIDs     []string          `json:"ExecIDs,omitempty" yaml:"ExecIDs,omitempty" toml:"ExecIDs,omitempty"`
	GraphDriver *GraphDriver      `json:"GraphDriver,omitempty" yaml:"GraphDriver,omitempty" toml:"GraphDriver,omitempty"`

	RestartCount int `json:"RestartCount,omitempty" yaml:"RestartCount,omitempty" toml:"RestartCount,omitempty"`

	AppArmorProfile string `json:"AppArmorProfile,omitempty" yaml:"AppArmorProfile,omitempty" toml:"AppArmorProfile,omitempty"`
}

Container is the type encompasing everything about a container - its config, hostconfig, etc.

type ContainerAlreadyRunning

type ContainerAlreadyRunning struct {
	ID string
}

ContainerAlreadyRunning is the error returned when a given container is already running.

func (*ContainerAlreadyRunning) Error

func (err *ContainerAlreadyRunning) Error() string

type ContainerNetwork

type ContainerNetwork struct {
	Aliases             []string `json:"Aliases,omitempty" yaml:"Aliases,omitempty" toml:"Aliases,omitempty"`
	MacAddress          string   `json:"MacAddress,omitempty" yaml:"MacAddress,omitempty" toml:"MacAddress,omitempty"`
	GlobalIPv6PrefixLen int      `json:"GlobalIPv6PrefixLen,omitempty" yaml:"GlobalIPv6PrefixLen,omitempty" toml:"GlobalIPv6PrefixLen,omitempty"`
	GlobalIPv6Address   string   `json:"GlobalIPv6Address,omitempty" yaml:"GlobalIPv6Address,omitempty" toml:"GlobalIPv6Address,omitempty"`
	IPv6Gateway         string   `json:"IPv6Gateway,omitempty" yaml:"IPv6Gateway,omitempty" toml:"IPv6Gateway,omitempty"`
	IPPrefixLen         int      `json:"IPPrefixLen,omitempty" yaml:"IPPrefixLen,omitempty" toml:"IPPrefixLen,omitempty"`
	IPAddress           string   `json:"IPAddress,omitempty" yaml:"IPAddress,omitempty" toml:"IPAddress,omitempty"`
	Gateway             string   `json:"Gateway,omitempty" yaml:"Gateway,omitempty" toml:"Gateway,omitempty"`
	EndpointID          string   `json:"EndpointID,omitempty" yaml:"EndpointID,omitempty" toml:"EndpointID,omitempty"`
	NetworkID           string   `json:"NetworkID,omitempty" yaml:"NetworkID,omitempty" toml:"NetworkID,omitempty"`
}

ContainerNetwork represents the networking settings of a container per network.

type ContainerNotRunning

type ContainerNotRunning struct {
	ID string
}

ContainerNotRunning is the error returned when a given container is not running.

func (*ContainerNotRunning) Error

func (err *ContainerNotRunning) Error() string

type CopyFromContainerOptions deprecated

type CopyFromContainerOptions struct {
	OutputStream io.Writer `json:"-"`
	Container    string    `json:"-"`
	Resource     string
	Context      context.Context `json:"-"`
}

CopyFromContainerOptions contains the set of options used for copying files from a container.

Deprecated: Use DownloadFromContainerOptions and DownloadFromContainer instead.

type CreateConfigOptions added in v1.1.0

type CreateConfigOptions struct {
	Auth AuthConfiguration `qs:"-"`
	swarm.ConfigSpec
	Context context.Context
}

CreateConfigOptions specify parameters to the CreateConfig function.

See https://goo.gl/KrVjHz for more details.

type CreateContainerOptions

type CreateContainerOptions struct {
	Name             string
	Config           *Config           `qs:"-"`
	HostConfig       *HostConfig       `qs:"-"`
	NetworkingConfig *NetworkingConfig `qs:"-"`
	Context          context.Context
}

CreateContainerOptions specify parameters to the CreateContainer function.

See https://goo.gl/tyzwVM for more details.

type CreateExecOptions

type CreateExecOptions struct {
	Env          []string        `json:"Env,omitempty" yaml:"Env,omitempty" toml:"Env,omitempty"`
	Cmd          []string        `json:"Cmd,omitempty" yaml:"Cmd,omitempty" toml:"Cmd,omitempty"`
	Container    string          `json:"Container,omitempty" yaml:"Container,omitempty" toml:"Container,omitempty"`
	User         string          `json:"User,omitempty" yaml:"User,omitempty" toml:"User,omitempty"`
	WorkingDir   string          `json:"WorkingDir,omitempty" yaml:"WorkingDir,omitempty" toml:"WorkingDir,omitempty"`
	Context      context.Context `json:"-"`
	AttachStdin  bool            `json:"AttachStdin,omitempty" yaml:"AttachStdin,omitempty" toml:"AttachStdin,omitempty"`
	AttachStdout bool            `json:"AttachStdout,omitempty" yaml:"AttachStdout,omitempty" toml:"AttachStdout,omitempty"`
	AttachStderr bool            `json:"AttachStderr,omitempty" yaml:"AttachStderr,omitempty" toml:"AttachStderr,omitempty"`
	Tty          bool            `json:"Tty,omitempty" yaml:"Tty,omitempty" toml:"Tty,omitempty"`
	Privileged   bool            `json:"Privileged,omitempty" yaml:"Privileged,omitempty" toml:"Privileged,omitempty"`
}

CreateExecOptions specify parameters to the CreateExecContainer function.

See https://goo.gl/60TeBP for more details

type CreateNetworkOptions

type CreateNetworkOptions struct {
	Name           string                 `json:"Name" yaml:"Name" toml:"Name"`
	Driver         string                 `json:"Driver" yaml:"Driver" toml:"Driver"`
	IPAM           *IPAMOptions           `json:"IPAM,omitempty" yaml:"IPAM" toml:"IPAM"`
	Options        map[string]interface{} `json:"Options" yaml:"Options" toml:"Options"`
	Labels         map[string]string      `json:"Labels" yaml:"Labels" toml:"Labels"`
	CheckDuplicate bool                   `json:"CheckDuplicate" yaml:"CheckDuplicate" toml:"CheckDuplicate"`
	Internal       bool                   `json:"Internal" yaml:"Internal" toml:"Internal"`
	EnableIPv6     bool                   `json:"EnableIPv6" yaml:"EnableIPv6" toml:"EnableIPv6"`
	Context        context.Context        `json:"-"`
}

CreateNetworkOptions specify parameters to the CreateNetwork function and (for now) is the expected body of the "create network" http request message

See https://goo.gl/6GugX3 for more details.

type CreatePluginOptions added in v1.2.0

type CreatePluginOptions struct {
	// The Name of the plugin.
	Name string `qs:"name"`
	// Path to tar containing plugin
	Path string `qs:"-"`

	Context context.Context
}

CreatePluginOptions specify parameters to the CreatePlugin function.

See https://goo.gl/C4t7Tz for more details.

type CreateSecretOptions added in v1.1.0

type CreateSecretOptions struct {
	Auth AuthConfiguration `qs:"-"`
	swarm.SecretSpec
	Context context.Context
}

CreateSecretOptions specify parameters to the CreateSecret function.

See https://goo.gl/KrVjHz for more details.

type CreateServiceOptions

type CreateServiceOptions struct {
	Auth AuthConfiguration `qs:"-"`
	swarm.ServiceSpec
	Context context.Context
}

CreateServiceOptions specify parameters to the CreateService function.

See https://goo.gl/KrVjHz for more details.

type CreateVolumeOptions

type CreateVolumeOptions struct {
	Name       string
	Driver     string
	DriverOpts map[string]string
	Context    context.Context `json:"-"`
	Labels     map[string]string
}

CreateVolumeOptions specify parameters to the CreateVolume function.

See https://goo.gl/qEhmEC for more details.

type Device

type Device struct {
	PathOnHost        string `json:"PathOnHost,omitempty" yaml:"PathOnHost,omitempty" toml:"PathOnHost,omitempty"`
	PathInContainer   string `json:"PathInContainer,omitempty" yaml:"PathInContainer,omitempty" toml:"PathInContainer,omitempty"`
	CgroupPermissions string `json:"CgroupPermissions,omitempty" yaml:"CgroupPermissions,omitempty" toml:"CgroupPermissions,omitempty"`
}

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

type Dialer

type Dialer interface {
	Dial(network, address string) (net.Conn, error)
}

Dialer is an interface that allows network connections to be dialed (net.Dialer fulfills this interface) and named pipes (a shim using winio.DialPipe)

type DisablePluginOptions added in v1.2.0

type DisablePluginOptions struct {
	// The Name of the plugin.
	Name string `qs:"-"`

	Context context.Context
}

DisablePluginOptions specify parameters to the DisablePlugin function.

See https://goo.gl/C4t7Tz for more details.

type DiskUsage added in v1.3.7

type DiskUsage struct {
	LayersSize int64
	Images     []*ImageSummary
	Containers []*APIContainers
	Volumes    []*Volume
}

DiskUsage holds information about what docker is using disk space on. More Info Here https://dockr.ly/2PNzQyO

type DiskUsageOptions added in v1.3.7

type DiskUsageOptions struct {
	Context context.Context
}

DiskUsageOptions only contains a context for canceling.

type DockerInfo

type DockerInfo struct {
	ID                 string
	Containers         int
	ContainersRunning  int
	ContainersPaused   int
	ContainersStopped  int
	Images             int
	Driver             string
	DriverStatus       [][2]string
	SystemStatus       [][2]string
	Plugins            PluginsInfo
	NFd                int
	NGoroutines        int
	SystemTime         string
	ExecutionDriver    string
	LoggingDriver      string
	CgroupDriver       string
	NEventsListener    int
	KernelVersion      string
	OperatingSystem    string
	OSType             string
	Architecture       string
	IndexServerAddress string
	RegistryConfig     *ServiceConfig
	SecurityOptions    []string
	NCPU               int
	MemTotal           int64
	DockerRootDir      string
	HTTPProxy          string `json:"HttpProxy"`
	HTTPSProxy         string `json:"HttpsProxy"`
	NoProxy            string
	Name               string
	Labels             []string
	ServerVersion      string
	ClusterStore       string
	Runtimes           map[string]Runtime
	ClusterAdvertise   string
	Isolation          string
	InitBinary         string
	DefaultRuntime     string
	Swarm              swarm.Info
	LiveRestoreEnabled bool
	MemoryLimit        bool
	SwapLimit          bool
	KernelMemory       bool
	CPUCfsPeriod       bool `json:"CpuCfsPeriod"`
	CPUCfsQuota        bool `json:"CpuCfsQuota"`
	CPUShares          bool
	CPUSet             bool
	IPv4Forwarding     bool
	BridgeNfIptables   bool
	BridgeNfIP6tables  bool `json:"BridgeNfIp6tables"`
	Debug              bool
	OomKillDisable     bool
	ExperimentalBuild  bool
}

DockerInfo contains information about the Docker server

See https://goo.gl/bHUoz9 for more details.

type DownloadFromContainerOptions

type DownloadFromContainerOptions struct {
	OutputStream      io.Writer     `json:"-" qs:"-"`
	Path              string        `qs:"path"`
	InactivityTimeout time.Duration `qs:"-"`
	Context           context.Context
}

DownloadFromContainerOptions is the set of options that can be used when downloading resources from a container.

See https://goo.gl/W49jxK for more details.

type EnablePluginOptions added in v1.2.0

type EnablePluginOptions struct {
	// The Name of the plugin.
	Name    string `qs:"-"`
	Timeout int64  `qs:"timeout"`

	Context context.Context
}

EnablePluginOptions specify parameters to the EnablePlugin function.

See https://goo.gl/C4t7Tz for more details.

type Endpoint

type Endpoint struct {
	Name        string
	ID          string `json:"EndpointID"`
	MacAddress  string
	IPv4Address string
	IPv6Address string
}

Endpoint contains network resources allocated and used for a container in a network

See https://goo.gl/6GugX3 for more details.

type EndpointConfig

type EndpointConfig struct {
	IPAMConfig          *EndpointIPAMConfig `json:"IPAMConfig,omitempty" yaml:"IPAMConfig,omitempty" toml:"IPAMConfig,omitempty"`
	Links               []string            `json:"Links,omitempty" yaml:"Links,omitempty" toml:"Links,omitempty"`
	Aliases             []string            `json:"Aliases,omitempty" yaml:"Aliases,omitempty" toml:"Aliases,omitempty"`
	NetworkID           string              `json:"NetworkID,omitempty" yaml:"NetworkID,omitempty" toml:"NetworkID,omitempty"`
	EndpointID          string              `json:"EndpointID,omitempty" yaml:"EndpointID,omitempty" toml:"EndpointID,omitempty"`
	Gateway             string              `json:"Gateway,omitempty" yaml:"Gateway,omitempty" toml:"Gateway,omitempty"`
	IPAddress           string              `json:"IPAddress,omitempty" yaml:"IPAddress,omitempty" toml:"IPAddress,omitempty"`
	IPPrefixLen         int                 `json:"IPPrefixLen,omitempty" yaml:"IPPrefixLen,omitempty" toml:"IPPrefixLen,omitempty"`
	IPv6Gateway         string              `json:"IPv6Gateway,omitempty" yaml:"IPv6Gateway,omitempty" toml:"IPv6Gateway,omitempty"`
	GlobalIPv6Address   string              `json:"GlobalIPv6Address,omitempty" yaml:"GlobalIPv6Address,omitempty" toml:"GlobalIPv6Address,omitempty"`
	GlobalIPv6PrefixLen int                 `json:"GlobalIPv6PrefixLen,omitempty" yaml:"GlobalIPv6PrefixLen,omitempty" toml:"GlobalIPv6PrefixLen,omitempty"`
	MacAddress          string              `json:"MacAddress,omitempty" yaml:"MacAddress,omitempty" toml:"MacAddress,omitempty"`
}

EndpointConfig stores network endpoint details

See https://goo.gl/RV7BJU for more details.

type EndpointIPAMConfig

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

EndpointIPAMConfig represents IPAM configurations for an endpoint

See https://goo.gl/RV7BJU for more details.

type Env

type Env []string

Env represents a list of key-pair represented in the form KEY=VALUE.

func (*Env) Decode

func (env *Env) Decode(src io.Reader) error

Decode decodes `src` as a json dictionary, and adds each decoded key-value pair to the environment.

If `src` cannot be decoded as a json dictionary, an error is returned.

func (*Env) Exists

func (env *Env) Exists(key string) bool

Exists checks whether the given key is defined in the internal Env representation.

func (*Env) Get

func (env *Env) Get(key string) (value string)

Get returns the string value of the given key.

func (*Env) GetBool

func (env *Env) GetBool(key string) (value bool)

GetBool returns a boolean representation of the given key. The key is false whenever its value if 0, no, false, none or an empty string. Any other value will be interpreted as true.

func (*Env) GetInt

func (env *Env) GetInt(key string) int

GetInt returns the value of the provided key, converted to int.

It the value cannot be represented as an integer, it returns -1.

func (*Env) GetInt64

func (env *Env) GetInt64(key string) int64

GetInt64 returns the value of the provided key, converted to int64.

It the value cannot be represented as an integer, it returns -1.

func (*Env) GetJSON

func (env *Env) GetJSON(key string, iface interface{}) error

GetJSON unmarshals the value of the provided key in the provided iface.

iface is a value that can be provided to the json.Unmarshal function.

Example
package main

import (
	"log"

	docker "github.com/fsouza/go-dockerclient"
)

func main() {
	type Person struct {
		Name string
		Age  int
	}
	p := Person{Name: "Gopher", Age: 4}
	var e docker.Env
	e.Set("person", `{"name":"Gopher","age":4}`)
	err := e.GetJSON("person", &p)
	if err != nil {
		log.Fatal(err)
	}
}
Output:

func (*Env) GetList

func (env *Env) GetList(key string) []string

GetList returns a list of strings matching the provided key. It handles the list as a JSON representation of a list of strings.

If the given key matches to a single string, it will return a list containing only the value that matches the key.

func (*Env) Map

func (env *Env) Map() map[string]string

Map returns the map representation of the env.

Example
package main

import (
	"fmt"

	docker "github.com/fsouza/go-dockerclient"
)

func main() {
	e := docker.Env([]string{"A=1", "B=2", "C=3"})
	envs := e.Map()
	for k, v := range envs {
		fmt.Printf("%s=%q\n", k, v)
	}
}
Output:

func (*Env) Set

func (env *Env) Set(key, value string)

Set defines the value of a key to the given string.

func (*Env) SetAuto

func (env *Env) SetAuto(key string, value interface{})

SetAuto will try to define the Set* method to call based on the given value.

func (*Env) SetBool

func (env *Env) SetBool(key string, value bool)

SetBool defines a boolean value to the given key.

func (*Env) SetInt

func (env *Env) SetInt(key string, value int)

SetInt defines an integer value to the given key.

func (*Env) SetInt64

func (env *Env) SetInt64(key string, value int64)

SetInt64 defines an integer (64-bit wide) value to the given key.

func (*Env) SetJSON

func (env *Env) SetJSON(key string, value interface{}) error

SetJSON marshals the given value to JSON format and stores it using the provided key.

Example
package main

import (
	"log"

	docker "github.com/fsouza/go-dockerclient"
)

func main() {
	type Person struct {
		Name string
		Age  int
	}
	p := Person{Name: "Gopher", Age: 4}
	var e docker.Env
	err := e.SetJSON("person", p)
	if err != nil {
		log.Fatal(err)
	}
}
Output:

func (*Env) SetList

func (env *Env) SetList(key string, value []string) error

SetList stores the given list in the provided key, after serializing it to JSON format.

type Error

type Error struct {
	Status  int
	Message string
}

Error represents failures in the API. It represents a failure from the API.

func (*Error) Error

func (e *Error) Error() string

type Exec

type Exec struct {
	ID string `json:"Id,omitempty" yaml:"Id,omitempty"`
}

Exec is the type representing a `docker exec` instance and containing the instance ID

type ExecInspect

type ExecInspect struct {
	ID            string            `json:"ID,omitempty" yaml:"ID,omitempty" toml:"ID,omitempty"`
	ExitCode      int               `json:"ExitCode,omitempty" yaml:"ExitCode,omitempty" toml:"ExitCode,omitempty"`
	ProcessConfig ExecProcessConfig `json:"ProcessConfig,omitempty" yaml:"ProcessConfig,omitempty" toml:"ProcessConfig,omitempty"`
	ContainerID   string            `json:"ContainerID,omitempty" yaml:"ContainerID,omitempty" toml:"ContainerID,omitempty"`
	DetachKeys    string            `json:"DetachKeys,omitempty" yaml:"DetachKeys,omitempty" toml:"DetachKeys,omitempty"`
	Running       bool              `json:"Running,omitempty" yaml:"Running,omitempty" toml:"Running,omitempty"`
	OpenStdin     bool              `json:"OpenStdin,omitempty" yaml:"OpenStdin,omitempty" toml:"OpenStdin,omitempty"`
	OpenStderr    bool              `json:"OpenStderr,omitempty" yaml:"OpenStderr,omitempty" toml:"OpenStderr,omitempty"`
	OpenStdout    bool              `json:"OpenStdout,omitempty" yaml:"OpenStdout,omitempty" toml:"OpenStdout,omitempty"`
	CanRemove     bool              `json:"CanRemove,omitempty" yaml:"CanRemove,omitempty" toml:"CanRemove,omitempty"`
}

ExecInspect is a type with details about a exec instance, including the exit code if the command has finished running. It's returned by a api call to /exec/(id)/json

See https://goo.gl/ctMUiW for more details

type ExecProcessConfig

type ExecProcessConfig struct {
	User       string   `json:"user,omitempty" yaml:"user,omitempty" toml:"user,omitempty"`
	Privileged bool     `json:"privileged,omitempty" yaml:"privileged,omitempty" toml:"privileged,omitempty"`
	Tty        bool     `json:"tty,omitempty" yaml:"tty,omitempty" toml:"tty,omitempty"`
	EntryPoint string   `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty" toml:"entrypoint,omitempty"`
	Arguments  []string `json:"arguments,omitempty" yaml:"arguments,omitempty" toml:"arguments,omitempty"`
}

ExecProcessConfig is a type describing the command associated to a Exec instance. It's used in the ExecInspect type.

type ExportContainerOptions

type ExportContainerOptions struct {
	ID                string
	OutputStream      io.Writer
	InactivityTimeout time.Duration `qs:"-"`
	Context           context.Context
}

ExportContainerOptions is the set of parameters to the ExportContainer method.

See https://goo.gl/yGJCIh for more details.

type ExportImageOptions

type ExportImageOptions struct {
	Name              string
	OutputStream      io.Writer
	InactivityTimeout time.Duration
	Context           context.Context
}

ExportImageOptions represent the options for ExportImage Docker API call.

See https://goo.gl/AuySaA for more details.

type ExportImagesOptions

type ExportImagesOptions struct {
	Names             []string
	OutputStream      io.Writer     `qs:"-"`
	InactivityTimeout time.Duration `qs:"-"`
	Context           context.Context
}

ExportImagesOptions represent the options for ExportImages Docker API call

See https://goo.gl/N9XlDn for more details.

type GraphDriver

type GraphDriver struct {
	Name string            `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
	Data map[string]string `json:"Data,omitempty" yaml:"Data,omitempty" toml:"Data,omitempty"`
}

GraphDriver contains information about the GraphDriver used by the container.

type Health

type Health struct {
	Status        string        `json:"Status,omitempty" yaml:"Status,omitempty" toml:"Status,omitempty"`
	FailingStreak int           `json:"FailingStreak,omitempty" yaml:"FailingStreak,omitempty" toml:"FailingStreak,omitempty"`
	Log           []HealthCheck `json:"Log,omitempty" yaml:"Log,omitempty" toml:"Log,omitempty"`
}

Health represents the health of a container.

type HealthCheck

type HealthCheck struct {
	Start    time.Time `json:"Start,omitempty" yaml:"Start,omitempty" toml:"Start,omitempty"`
	End      time.Time `json:"End,omitempty" yaml:"End,omitempty" toml:"End,omitempty"`
	ExitCode int       `json:"ExitCode,omitempty" yaml:"ExitCode,omitempty" toml:"ExitCode,omitempty"`
	Output   string    `json:"Output,omitempty" yaml:"Output,omitempty" toml:"Output,omitempty"`
}

HealthCheck represents one check of health.

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" yaml:"Test,omitempty" toml:"Test,omitempty"`

	// Zero means to inherit. Durations are expressed as integer nanoseconds.
	Interval    time.Duration `json:"Interval,omitempty" yaml:"Interval,omitempty" toml:"Interval,omitempty"`          // Interval is the time to wait between checks.
	Timeout     time.Duration `json:"Timeout,omitempty" yaml:"Timeout,omitempty" toml:"Timeout,omitempty"`             // Timeout is the time to wait before considering the check to have hung.
	StartPeriod time.Duration `json:"StartPeriod,omitempty" yaml:"StartPeriod,omitempty" toml:"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" yaml:"Retries,omitempty" toml:"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" yaml:"Binds,omitempty" toml:"Binds,omitempty"`
	CapAdd               []string               `json:"CapAdd,omitempty" yaml:"CapAdd,omitempty" toml:"CapAdd,omitempty"`
	CapDrop              []string               `json:"CapDrop,omitempty" yaml:"CapDrop,omitempty" toml:"CapDrop,omitempty"`
	GroupAdd             []string               `json:"GroupAdd,omitempty" yaml:"GroupAdd,omitempty" toml:"GroupAdd,omitempty"`
	ContainerIDFile      string                 `json:"ContainerIDFile,omitempty" yaml:"ContainerIDFile,omitempty" toml:"ContainerIDFile,omitempty"`
	LxcConf              []KeyValuePair         `json:"LxcConf,omitempty" yaml:"LxcConf,omitempty" toml:"LxcConf,omitempty"`
	PortBindings         map[Port][]PortBinding `json:"PortBindings,omitempty" yaml:"PortBindings,omitempty" toml:"PortBindings,omitempty"`
	Links                []string               `json:"Links,omitempty" yaml:"Links,omitempty" toml:"Links,omitempty"`
	DNS                  []string               `json:"Dns,omitempty" yaml:"Dns,omitempty" toml:"Dns,omitempty"` // For Docker API v1.10 and above only
	DNSOptions           []string               `json:"DnsOptions,omitempty" yaml:"DnsOptions,omitempty" toml:"DnsOptions,omitempty"`
	DNSSearch            []string               `json:"DnsSearch,omitempty" yaml:"DnsSearch,omitempty" toml:"DnsSearch,omitempty"`
	ExtraHosts           []string               `json:"ExtraHosts,omitempty" yaml:"ExtraHosts,omitempty" toml:"ExtraHosts,omitempty"`
	VolumesFrom          []string               `json:"VolumesFrom,omitempty" yaml:"VolumesFrom,omitempty" toml:"VolumesFrom,omitempty"`
	UsernsMode           string                 `json:"UsernsMode,omitempty" yaml:"UsernsMode,omitempty" toml:"UsernsMode,omitempty"`
	NetworkMode          string                 `json:"NetworkMode,omitempty" yaml:"NetworkMode,omitempty" toml:"NetworkMode,omitempty"`
	IpcMode              string                 `json:"IpcMode,omitempty" yaml:"IpcMode,omitempty" toml:"IpcMode,omitempty"`
	PidMode              string                 `json:"PidMode,omitempty" yaml:"PidMode,omitempty" toml:"PidMode,omitempty"`
	UTSMode              string                 `json:"UTSMode,omitempty" yaml:"UTSMode,omitempty" toml:"UTSMode,omitempty"`
	RestartPolicy        RestartPolicy          `json:"RestartPolicy,omitempty" yaml:"RestartPolicy,omitempty" toml:"RestartPolicy,omitempty"`
	Devices              []Device               `json:"Devices,omitempty" yaml:"Devices,omitempty" toml:"Devices,omitempty"`
	DeviceCgroupRules    []string               `json:"DeviceCgroupRules,omitempty" yaml:"DeviceCgroupRules,omitempty" toml:"DeviceCgroupRules,omitempty"`
	LogConfig            LogConfig              `json:"LogConfig,omitempty" yaml:"LogConfig,omitempty" toml:"LogConfig,omitempty"`
	SecurityOpt          []string               `json:"SecurityOpt,omitempty" yaml:"SecurityOpt,omitempty" toml:"SecurityOpt,omitempty"`
	Cgroup               string                 `json:"Cgroup,omitempty" yaml:"Cgroup,omitempty" toml:"Cgroup,omitempty"`
	CgroupParent         string                 `json:"CgroupParent,omitempty" yaml:"CgroupParent,omitempty" toml:"CgroupParent,omitempty"`
	Memory               int64                  `json:"Memory,omitempty" yaml:"Memory,omitempty" toml:"Memory,omitempty"`
	MemoryReservation    int64                  `json:"MemoryReservation,omitempty" yaml:"MemoryReservation,omitempty" toml:"MemoryReservation,omitempty"`
	KernelMemory         int64                  `json:"KernelMemory,omitempty" yaml:"KernelMemory,omitempty" toml:"KernelMemory,omitempty"`
	MemorySwap           int64                  `json:"MemorySwap,omitempty" yaml:"MemorySwap,omitempty" toml:"MemorySwap,omitempty"`
	MemorySwappiness     int64                  `json:"MemorySwappiness,omitempty" yaml:"MemorySwappiness,omitempty" toml:"MemorySwappiness,omitempty"`
	CPUShares            int64                  `json:"CpuShares,omitempty" yaml:"CpuShares,omitempty" toml:"CpuShares,omitempty"`
	CPUSet               string                 `json:"Cpuset,omitempty" yaml:"Cpuset,omitempty" toml:"Cpuset,omitempty"`
	CPUSetCPUs           string                 `json:"CpusetCpus,omitempty" yaml:"CpusetCpus,omitempty" toml:"CpusetCpus,omitempty"`
	CPUSetMEMs           string                 `json:"CpusetMems,omitempty" yaml:"CpusetMems,omitempty" toml:"CpusetMems,omitempty"`
	CPUQuota             int64                  `json:"CpuQuota,omitempty" yaml:"CpuQuota,omitempty" toml:"CpuQuota,omitempty"`
	CPUPeriod            int64                  `json:"CpuPeriod,omitempty" yaml:"CpuPeriod,omitempty" toml:"CpuPeriod,omitempty"`
	CPURealtimePeriod    int64                  `json:"CpuRealtimePeriod,omitempty" yaml:"CpuRealtimePeriod,omitempty" toml:"CpuRealtimePeriod,omitempty"`
	CPURealtimeRuntime   int64                  `json:"CpuRealtimeRuntime,omitempty" yaml:"CpuRealtimeRuntime,omitempty" toml:"CpuRealtimeRuntime,omitempty"`
	BlkioWeight          int64                  `json:"BlkioWeight,omitempty" yaml:"BlkioWeight,omitempty" toml:"BlkioWeight,omitempty"`
	BlkioWeightDevice    []BlockWeight          `json:"BlkioWeightDevice,omitempty" yaml:"BlkioWeightDevice,omitempty" toml:"BlkioWeightDevice,omitempty"`
	BlkioDeviceReadBps   []BlockLimit           `json:"BlkioDeviceReadBps,omitempty" yaml:"BlkioDeviceReadBps,omitempty" toml:"BlkioDeviceReadBps,omitempty"`
	BlkioDeviceReadIOps  []BlockLimit           `json:"BlkioDeviceReadIOps,omitempty" yaml:"BlkioDeviceReadIOps,omitempty" toml:"BlkioDeviceReadIOps,omitempty"`
	BlkioDeviceWriteBps  []BlockLimit           `json:"BlkioDeviceWriteBps,omitempty" yaml:"BlkioDeviceWriteBps,omitempty" toml:"BlkioDeviceWriteBps,omitempty"`
	BlkioDeviceWriteIOps []BlockLimit           `json:"BlkioDeviceWriteIOps,omitempty" yaml:"BlkioDeviceWriteIOps,omitempty" toml:"BlkioDeviceWriteIOps,omitempty"`
	Ulimits              []ULimit               `json:"Ulimits,omitempty" yaml:"Ulimits,omitempty" toml:"Ulimits,omitempty"`
	VolumeDriver         string                 `json:"VolumeDriver,omitempty" yaml:"VolumeDriver,omitempty" toml:"VolumeDriver,omitempty"`
	OomScoreAdj          int                    `json:"OomScoreAdj,omitempty" yaml:"OomScoreAdj,omitempty" toml:"OomScoreAdj,omitempty"`
	PidsLimit            int64                  `json:"PidsLimit,omitempty" yaml:"PidsLimit,omitempty" toml:"PidsLimit,omitempty"`
	ShmSize              int64                  `json:"ShmSize,omitempty" yaml:"ShmSize,omitempty" toml:"ShmSize,omitempty"`
	Tmpfs                map[string]string      `json:"Tmpfs,omitempty" yaml:"Tmpfs,omitempty" toml:"Tmpfs,omitempty"`
	StorageOpt           map[string]string      `json:"StorageOpt,omitempty" yaml:"StorageOpt,omitempty" toml:"StorageOpt,omitempty"`
	Sysctls              map[string]string      `json:"Sysctls,omitempty" yaml:"Sysctls,omitempty" toml:"Sysctls,omitempty"`
	CPUCount             int64                  `json:"CpuCount,omitempty" yaml:"CpuCount,omitempty"`
	CPUPercent           int64                  `json:"CpuPercent,omitempty" yaml:"CpuPercent,omitempty"`
	IOMaximumBandwidth   int64                  `json:"IOMaximumBandwidth,omitempty" yaml:"IOMaximumBandwidth,omitempty"`
	IOMaximumIOps        int64                  `json:"IOMaximumIOps,omitempty" yaml:"IOMaximumIOps,omitempty"`
	Mounts               []HostMount            `json:"Mounts,omitempty" yaml:"Mounts,omitempty" toml:"Mounts,omitempty"`
	Runtime              string                 `json:"Runtime,omitempty" yaml:"Runtime,omitempty" toml:"Runtime,omitempty"`
	Init                 bool                   `json:",omitempty" yaml:",omitempty"`
	Privileged           bool                   `json:"Privileged,omitempty" yaml:"Privileged,omitempty" toml:"Privileged,omitempty"`
	PublishAllPorts      bool                   `json:"PublishAllPorts,omitempty" yaml:"PublishAllPorts,omitempty" toml:"PublishAllPorts,omitempty"`
	ReadonlyRootfs       bool                   `json:"ReadonlyRootfs,omitempty" yaml:"ReadonlyRootfs,omitempty" toml:"ReadonlyRootfs,omitempty"`
	OOMKillDisable       bool                   `json:"OomKillDisable,omitempty" yaml:"OomKillDisable,omitempty" toml:"OomKillDisable,omitempty"`
	AutoRemove           bool                   `json:"AutoRemove,omitempty" yaml:"AutoRemove,omitempty" toml:"AutoRemove,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" yaml:"Target,omitempty" toml:"Target,omitempty"`
	Source        string         `json:"Source,omitempty" yaml:"Source,omitempty" toml:"Source,omitempty"`
	Type          string         `json:"Type,omitempty" yaml:"Type,omitempty" toml:"Type,omitempty"`
	ReadOnly      bool           `json:"ReadOnly,omitempty" yaml:"ReadOnly,omitempty" toml:"ReadOnly,omitempty"`
	BindOptions   *BindOptions   `json:"BindOptions,omitempty" yaml:"BindOptions,omitempty" toml:"BindOptions,omitempty"`
	VolumeOptions *VolumeOptions `json:"VolumeOptions,omitempty" yaml:"VolumeOptions,omitempty" toml:"VolumeOptions,omitempty"`
	TempfsOptions *TempfsOptions `json:"TempfsOptions,omitempty" yaml:"TempfsOptions,omitempty" toml:"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 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

See https://goo.gl/T8kRVH for more details.

type IPAMOptions

type IPAMOptions struct {
	Driver  string            `json:"Driver" yaml:"Driver" toml:"Driver"`
	Config  []IPAMConfig      `json:"Config" yaml:"Config" toml:"Config"`
	Options map[string]string `json:"Options" yaml:"Options" toml:"Options"`
}

IPAMOptions controls IP Address Management when creating a network

See https://goo.gl/T8kRVH for more details.

type Image

type Image struct {
	ID              string    `json:"Id" yaml:"Id" toml:"Id"`
	RepoTags        []string  `json:"RepoTags,omitempty" yaml:"RepoTags,omitempty" toml:"RepoTags,omitempty"`
	Parent          string    `json:"Parent,omitempty" yaml:"Parent,omitempty" toml:"Parent,omitempty"`
	Comment         string    `json:"Comment,omitempty" yaml:"Comment,omitempty" toml:"Comment,omitempty"`
	Created         time.Time `json:"Created,omitempty" yaml:"Created,omitempty" toml:"Created,omitempty"`
	Container       string    `json:"Container,omitempty" yaml:"Container,omitempty" toml:"Container,omitempty"`
	ContainerConfig Config    `json:"ContainerConfig,omitempty" yaml:"ContainerConfig,omitempty" toml:"ContainerConfig,omitempty"`
	DockerVersion   string    `json:"DockerVersion,omitempty" yaml:"DockerVersion,omitempty" toml:"DockerVersion,omitempty"`
	Author          string    `json:"Author,omitempty" yaml:"Author,omitempty" toml:"Author,omitempty"`
	Config          *Config   `json:"Config,omitempty" yaml:"Config,omitempty" toml:"Config,omitempty"`
	Architecture    string    `json:"Architecture,omitempty" yaml:"Architecture,omitempty"`
	Size            int64     `json:"Size,omitempty" yaml:"Size,omitempty" toml:"Size,omitempty"`
	VirtualSize     int64     `json:"VirtualSize,omitempty" yaml:"VirtualSize,omitempty" toml:"VirtualSize,omitempty"`
	RepoDigests     []string  `json:"RepoDigests,omitempty" yaml:"RepoDigests,omitempty" toml:"RepoDigests,omitempty"`
	RootFS          *RootFS   `json:"RootFS,omitempty" yaml:"RootFS,omitempty" toml:"RootFS,omitempty"`
	OS              string    `json:"Os,omitempty" yaml:"Os,omitempty" toml:"Os,omitempty"`
}

Image is the type representing a docker image and its various properties

type ImageHistory

type ImageHistory struct {
	ID        string   `json:"Id" yaml:"Id" toml:"Id"`
	Tags      []string `json:"Tags,omitempty" yaml:"Tags,omitempty" toml:"Tags,omitempty"`
	Created   int64    `json:"Created,omitempty" yaml:"Created,omitempty" toml:"Tags,omitempty"`
	CreatedBy string   `json:"CreatedBy,omitempty" yaml:"CreatedBy,omitempty" toml:"CreatedBy,omitempty"`
	Size      int64    `json:"Size,omitempty" yaml:"Size,omitempty" toml:"Size,omitempty"`
}

ImageHistory represent a layer in an image's history returned by the ImageHistory call.

type ImagePre012

type ImagePre012 struct {
	ID              string    `json:"id"`
	Parent          string    `json:"parent,omitempty"`
	Comment         string    `json:"comment,omitempty"`
	Created         time.Time `json:"created"`
	Container       string    `json:"container,omitempty"`
	ContainerConfig Config    `json:"container_config,omitempty"`
	DockerVersion   string    `json:"docker_version,omitempty"`
	Author          string    `json:"author,omitempty"`
	Config          *Config   `json:"config,omitempty"`
	Architecture    string    `json:"architecture,omitempty"`
	Size            int64     `json:"size,omitempty"`
}

ImagePre012 serves the same purpose as the Image type except that it is for earlier versions of the Docker API (pre-012 to be specific)

type ImageSummary added in v1.3.7

type ImageSummary struct {
	Containers  int64             `json:"Containers"`
	Created     int64             `json:"Created"`
	ID          string            `json:"Id"`
	Labels      map[string]string `json:"Labels"`
	ParentID    string            `json:"ParentId"`
	RepoDigests []string          `json:"RepoDigests"`
	RepoTags    []string          `json:"RepoTags"`
	SharedSize  int64             `json:"SharedSize"`
	Size        int64             `json:"Size"`
	VirtualSize int64             `json:"VirtualSize"`
}

ImageSummary represents data about what images are currently known to docker More Info Here https://dockr.ly/2PNzQyO

type ImportImageOptions

type ImportImageOptions struct {
	Repository string `qs:"repo"`
	Source     string `qs:"fromSrc"`
	Tag        string `qs:"tag"`

	InputStream       io.Reader     `qs:"-"`
	OutputStream      io.Writer     `qs:"-"`
	RawJSONStream     bool          `qs:"-"`
	InactivityTimeout time.Duration `qs:"-"`
	Context           context.Context
}

ImportImageOptions present the set of informations available for importing an image from a source file or the stdin.

See https://goo.gl/qkoSsn for more details.

type IndexInfo

type IndexInfo struct {
	Name     string
	Mirrors  []string
	Secure   bool
	Official bool
}

IndexInfo contains information about a registry.

for more information, see: https://goo.gl/7iFFDz

type InitSwarmOptions

type InitSwarmOptions struct {
	swarm.InitRequest
	Context context.Context
}

InitSwarmOptions specify parameters to the InitSwarm function. See https://goo.gl/hzkgWu for more details.

type InstallPluginOptions added in v1.2.0

type InstallPluginOptions struct {
	Remote  string
	Name    string
	Plugins []PluginPrivilege `qs:"-"`

	Auth AuthConfiguration

	Context context.Context
}

InstallPluginOptions specify parameters to the InstallPlugins function.

See https://goo.gl/C4t7Tz for more details.

type JoinSwarmOptions

type JoinSwarmOptions struct {
	swarm.JoinRequest
	Context context.Context
}

JoinSwarmOptions specify parameters to the JoinSwarm function. See https://goo.gl/TdhJWU for more details.

type KeyValuePair

type KeyValuePair struct {
	Key   string `json:"Key,omitempty" yaml:"Key,omitempty" toml:"Key,omitempty"`
	Value string `json:"Value,omitempty" yaml:"Value,omitempty" toml:"Value,omitempty"`
}

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

type KillContainerOptions

type KillContainerOptions struct {
	// The ID of the container.
	ID string `qs:"-"`

	// The signal to send to the container. When omitted, Docker server
	// will assume SIGKILL.
	Signal  Signal
	Context context.Context
}

KillContainerOptions represents the set of options that can be used in a call to KillContainer.

See https://goo.gl/JnTxXZ for more details.

type LeaveSwarmOptions

type LeaveSwarmOptions struct {
	Force   bool
	Context context.Context
}

LeaveSwarmOptions specify parameters to the LeaveSwarm function. See https://goo.gl/UWDlLg for more details.

type ListConfigsOptions added in v1.1.0

type ListConfigsOptions struct {
	Filters map[string][]string
	Context context.Context
}

ListConfigsOptions specify parameters to the ListConfigs function.

See https://goo.gl/DwvNMd for more details.

type ListContainersOptions

type ListContainersOptions struct {
	All     bool
	Size    bool
	Limit   int
	Since   string
	Before  string
	Filters map[string][]string
	Context context.Context
}

ListContainersOptions specify parameters to the ListContainers function.

See https://goo.gl/kaOHGw for more details.

type ListFilteredPluginsOptions added in v1.2.1

type ListFilteredPluginsOptions struct {
	Filters map[string][]string
	Context context.Context
}

ListFilteredPluginsOptions specify parameters to the ListFilteredPlugins function.

See https://goo.gl/C4t7Tz for more details.

type ListImagesOptions

type ListImagesOptions struct {
	Filters map[string][]string
	All     bool
	Digests bool
	Filter  string
	Context context.Context
}

ListImagesOptions specify parameters to the ListImages function.

See https://goo.gl/BVzauZ for more details.

type ListNodesOptions

type ListNodesOptions struct {
	Filters map[string][]string
	Context context.Context
}

ListNodesOptions specify parameters to the ListNodes function.

See http://goo.gl/3K4GwU for more details.

type ListSecretsOptions added in v1.1.0

type ListSecretsOptions struct {
	Filters map[string][]string
	Context context.Context
}

ListSecretsOptions specify parameters to the ListSecrets function.

See https://goo.gl/DwvNMd for more details.

type ListServicesOptions

type ListServicesOptions struct {
	Filters map[string][]string
	Context context.Context
}

ListServicesOptions specify parameters to the ListServices function.

See https://goo.gl/DwvNMd for more details.

type ListTasksOptions

type ListTasksOptions struct {
	Filters map[string][]string
	Context context.Context
}

ListTasksOptions specify parameters to the ListTasks function.

See http://goo.gl/rByLzw for more details.

type ListVolumesOptions

type ListVolumesOptions struct {
	Filters map[string][]string
	Context context.Context
}

ListVolumesOptions specify parameters to the ListVolumes function.

See https://goo.gl/3wgTsd for more details.

type LoadImageOptions

type LoadImageOptions struct {
	InputStream  io.Reader
	OutputStream io.Writer
	Context      context.Context
}

LoadImageOptions represents the options for LoadImage Docker API Call

See https://goo.gl/rEsBV3 for more details.

type LogConfig

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

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

type LogsOptions

type LogsOptions struct {
	Context           context.Context
	Container         string        `qs:"-"`
	OutputStream      io.Writer     `qs:"-"`
	ErrorStream       io.Writer     `qs:"-"`
	InactivityTimeout time.Duration `qs:"-"`
	Tail              string

	Since      int64
	Follow     bool
	Stdout     bool
	Stderr     bool
	Timestamps bool

	// Use raw terminal? Usually true when the container contains a TTY.
	RawTerminal bool `qs:"-"`
}

LogsOptions represents the set of options used when getting logs from a container.

See https://goo.gl/krK0ZH for more details.

type LogsServiceOptions

type LogsServiceOptions struct {
	Context           context.Context
	Service           string        `qs:"-"`
	OutputStream      io.Writer     `qs:"-"`
	ErrorStream       io.Writer     `qs:"-"`
	InactivityTimeout time.Duration `qs:"-"`
	Tail              string
	Since             int64

	// Use raw terminal? Usually true when the container contains a TTY.
	RawTerminal bool `qs:"-"`
	Follow      bool
	Stdout      bool
	Stderr      bool
	Timestamps  bool
	Details     bool
}

LogsServiceOptions represents the set of options used when getting logs from a service.

type Mount

type Mount struct {
	Name        string
	Source      string
	Destination string
	Driver      string
	Mode        string
	RW          bool
}

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 NetIPNet

type NetIPNet net.IPNet

NetIPNet is the net.IPNet type, which can be marshalled and unmarshalled to JSON.

for more information, see: https://goo.gl/7iFFDz

func (*NetIPNet) MarshalJSON

func (ipnet *NetIPNet) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of the IPNet.

func (*NetIPNet) UnmarshalJSON

func (ipnet *NetIPNet) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON sets the IPNet from a byte array of JSON.

type Network

type Network struct {
	Name       string
	ID         string `json:"Id"`
	Scope      string
	Driver     string
	IPAM       IPAMOptions
	Containers map[string]Endpoint
	Options    map[string]string
	Internal   bool
	EnableIPv6 bool `json:"EnableIPv6"`
	Labels     map[string]string
}

Network represents a network.

See https://goo.gl/6GugX3 for more details.

type NetworkConnectionOptions

type NetworkConnectionOptions struct {
	Container string

	// EndpointConfig is only applicable to the ConnectNetwork call
	EndpointConfig *EndpointConfig `json:"EndpointConfig,omitempty"`

	// Force is only applicable to the DisconnectNetwork call
	Force bool

	Context context.Context `json:"-"`
}

NetworkConnectionOptions specify parameters to the ConnectNetwork and DisconnectNetwork function.

See https://goo.gl/RV7BJU for more details.

type NetworkFilterOpts

type NetworkFilterOpts map[string]map[string]bool

NetworkFilterOpts is an aggregation of key=value that Docker uses to filter networks

type NetworkList

type NetworkList struct {
	Networks map[string]ContainerNetwork `json:"Networks" yaml:"Networks,omitempty" toml:"Networks,omitempty"`
}

NetworkList encapsulates a map of networks, as returned by the Docker API in ListContainers.

type NetworkSettings

type NetworkSettings struct {
	Networks               map[string]ContainerNetwork `json:"Networks,omitempty" yaml:"Networks,omitempty" toml:"Networks,omitempty"`
	IPAddress              string                      `json:"IPAddress,omitempty" yaml:"IPAddress,omitempty" toml:"IPAddress,omitempty"`
	IPPrefixLen            int                         `json:"IPPrefixLen,omitempty" yaml:"IPPrefixLen,omitempty" toml:"IPPrefixLen,omitempty"`
	MacAddress             string                      `json:"MacAddress,omitempty" yaml:"MacAddress,omitempty" toml:"MacAddress,omitempty"`
	Gateway                string                      `json:"Gateway,omitempty" yaml:"Gateway,omitempty" toml:"Gateway,omitempty"`
	Bridge                 string                      `json:"Bridge,omitempty" yaml:"Bridge,omitempty" toml:"Bridge,omitempty"`
	PortMapping            map[string]PortMapping      `json:"PortMapping,omitempty" yaml:"PortMapping,omitempty" toml:"PortMapping,omitempty"`
	Ports                  map[Port][]PortBinding      `json:"Ports,omitempty" yaml:"Ports,omitempty" toml:"Ports,omitempty"`
	NetworkID              string                      `json:"NetworkID,omitempty" yaml:"NetworkID,omitempty" toml:"NetworkID,omitempty"`
	EndpointID             string                      `json:"EndpointID,omitempty" yaml:"EndpointID,omitempty" toml:"EndpointID,omitempty"`
	SandboxKey             string                      `json:"SandboxKey,omitempty" yaml:"SandboxKey,omitempty" toml:"SandboxKey,omitempty"`
	GlobalIPv6Address      string                      `json:"GlobalIPv6Address,omitempty" yaml:"GlobalIPv6Address,omitempty" toml:"GlobalIPv6Address,omitempty"`
	GlobalIPv6PrefixLen    int                         `json:"GlobalIPv6PrefixLen,omitempty" yaml:"GlobalIPv6PrefixLen,omitempty" toml:"GlobalIPv6PrefixLen,omitempty"`
	IPv6Gateway            string                      `json:"IPv6Gateway,omitempty" yaml:"IPv6Gateway,omitempty" toml:"IPv6Gateway,omitempty"`
	LinkLocalIPv6Address   string                      `json:"LinkLocalIPv6Address,omitempty" yaml:"LinkLocalIPv6Address,omitempty" toml:"LinkLocalIPv6Address,omitempty"`
	LinkLocalIPv6PrefixLen int                         `json:"LinkLocalIPv6PrefixLen,omitempty" yaml:"LinkLocalIPv6PrefixLen,omitempty" toml:"LinkLocalIPv6PrefixLen,omitempty"`
	SecondaryIPAddresses   []string                    `json:"SecondaryIPAddresses,omitempty" yaml:"SecondaryIPAddresses,omitempty" toml:"SecondaryIPAddresses,omitempty"`
	SecondaryIPv6Addresses []string                    `json:"SecondaryIPv6Addresses,omitempty" yaml:"SecondaryIPv6Addresses,omitempty" toml:"SecondaryIPv6Addresses,omitempty"`
}

NetworkSettings contains network-related information about a container

func (*NetworkSettings) PortMappingAPI

func (settings *NetworkSettings) PortMappingAPI() []APIPort

PortMappingAPI translates the port mappings as contained in NetworkSettings into the format in which they would appear when returned by the API

type NetworkStats

type NetworkStats struct {
	RxDropped uint64 `json:"rx_dropped,omitempty" yaml:"rx_dropped,omitempty" toml:"rx_dropped,omitempty"`
	RxBytes   uint64 `json:"rx_bytes,omitempty" yaml:"rx_bytes,omitempty" toml:"rx_bytes,omitempty"`
	RxErrors  uint64 `json:"rx_errors,omitempty" yaml:"rx_errors,omitempty" toml:"rx_errors,omitempty"`
	TxPackets uint64 `json:"tx_packets,omitempty" yaml:"tx_packets,omitempty" toml:"tx_packets,omitempty"`
	TxDropped uint64 `json:"tx_dropped,omitempty" yaml:"tx_dropped,omitempty" toml:"tx_dropped,omitempty"`
	RxPackets uint64 `json:"rx_packets,omitempty" yaml:"rx_packets,omitempty" toml:"rx_packets,omitempty"`
	TxErrors  uint64 `json:"tx_errors,omitempty" yaml:"tx_errors,omitempty" toml:"tx_errors,omitempty"`
	TxBytes   uint64 `json:"tx_bytes,omitempty" yaml:"tx_bytes,omitempty" toml:"tx_bytes,omitempty"`
}

NetworkStats is a stats entry for network stats

type NetworkingConfig

type NetworkingConfig struct {
	EndpointsConfig map[string]*EndpointConfig `json:"EndpointsConfig" yaml:"EndpointsConfig" toml:"EndpointsConfig"` // 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 NoSuchConfig added in v1.1.0

type NoSuchConfig struct {
	ID  string
	Err error
}

NoSuchConfig is the error returned when a given config does not exist.

func (*NoSuchConfig) Error added in v1.1.0

func (err *NoSuchConfig) Error() string

type NoSuchContainer

type NoSuchContainer struct {
	ID  string
	Err error
}

NoSuchContainer is the error returned when a given container does not exist.

func (*NoSuchContainer) Error

func (err *NoSuchContainer) Error() string

type NoSuchExec

type NoSuchExec struct {
	ID string
}

NoSuchExec is the error returned when a given exec instance does not exist.

func (*NoSuchExec) Error

func (err *NoSuchExec) Error() string

type NoSuchNetwork

type NoSuchNetwork struct {
	ID string
}

NoSuchNetwork is the error returned when a given network does not exist.

func (*NoSuchNetwork) Error

func (err *NoSuchNetwork) Error() string

type NoSuchNetworkOrContainer

type NoSuchNetworkOrContainer struct {
	NetworkID   string
	ContainerID string
}

NoSuchNetworkOrContainer is the error returned when a given network or container does not exist.

func (*NoSuchNetworkOrContainer) Error

func (err *NoSuchNetworkOrContainer) Error() string

type NoSuchNode

type NoSuchNode struct {
	ID  string
	Err error
}

NoSuchNode is the error returned when a given node does not exist.

func (*NoSuchNode) Error

func (err *NoSuchNode) Error() string

type NoSuchPlugin added in v1.2.0

type NoSuchPlugin struct {
	ID  string
	Err error
}

NoSuchPlugin is the error returned when a given plugin does not exist.

func (*NoSuchPlugin) Error added in v1.2.0

func (err *NoSuchPlugin) Error() string

type NoSuchSecret added in v1.1.0

type NoSuchSecret struct {
	ID  string
	Err error
}

NoSuchSecret is the error returned when a given secret does not exist.

func (*NoSuchSecret) Error added in v1.1.0

func (err *NoSuchSecret) Error() string

type NoSuchService

type NoSuchService struct {
	ID  string
	Err error
}

NoSuchService is the error returned when a given service does not exist.

func (*NoSuchService) Error

func (err *NoSuchService) Error() string

type NoSuchTask

type NoSuchTask struct {
	ID  string
	Err error
}

NoSuchTask is the error returned when a given task does not exist.

func (*NoSuchTask) Error

func (err *NoSuchTask) Error() string

type PluginArgs added in v1.2.0

type PluginArgs struct {
	Name        string   `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
	Description string   `json:"Description,omitempty" yaml:"Description,omitempty" toml:"Description,omitempty"`
	Settable    []string `json:"Settable,omitempty" yaml:"Settable,omitempty" toml:"Settable,omitempty"`
	Value       []string `json:"Value,omitempty" yaml:"Value,omitempty" toml:"Value,omitempty"`
}

PluginArgs stores plugin arguments.

See https://goo.gl/C4t7Tz for more details.

type PluginConfig added in v1.2.0

type PluginConfig struct {
	Description     string `json:"Description,omitempty" yaml:"Description,omitempty" toml:"Description,omitempty"`
	Documentation   string
	Interface       PluginInterface `json:"Interface,omitempty" yaml:"Interface,omitempty" toml:"Interface,omitempty"`
	Entrypoint      []string        `json:"Entrypoint,omitempty" yaml:"Entrypoint,omitempty" toml:"Entrypoint,omitempty"`
	WorkDir         string          `json:"WorkDir,omitempty" yaml:"WorkDir,omitempty" toml:"WorkDir,omitempty"`
	User            PluginUser      `json:"User,omitempty" yaml:"User,omitempty" toml:"User,omitempty"`
	Network         PluginNetwork   `json:"Network,omitempty" yaml:"Network,omitempty" toml:"Network,omitempty"`
	Linux           PluginLinux     `json:"Linux,omitempty" yaml:"Linux,omitempty" toml:"Linux,omitempty"`
	PropagatedMount string          `json:"PropagatedMount,omitempty" yaml:"PropagatedMount,omitempty" toml:"PropagatedMount,omitempty"`
	Mounts          []Mount         `json:"Mounts,omitempty" yaml:"Mounts,omitempty" toml:"Mounts,omitempty"`
	Env             []PluginEnv     `json:"Env,omitempty" yaml:"Env,omitempty" toml:"Env,omitempty"`
	Args            PluginArgs      `json:"Args,omitempty" yaml:"Args,omitempty" toml:"Args,omitempty"`
}

PluginConfig stores plugin config.

See https://goo.gl/C4t7Tz for more details.

type PluginDetail added in v1.2.0

type PluginDetail struct {
	ID       string         `json:"Id,omitempty" yaml:"Id,omitempty" toml:"Id,omitempty"`
	Name     string         `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
	Tag      string         `json:"Tag,omitempty" yaml:"Tag,omitempty" toml:"Tag,omitempty"`
	Active   bool           `json:"Enabled,omitempty" yaml:"Active,omitempty" toml:"Active,omitempty"`
	Settings PluginSettings `json:"Settings,omitempty" yaml:"Settings,omitempty" toml:"Settings,omitempty"`
	Config   PluginConfig   `json:"Config,omitempty" yaml:"Config,omitempty" toml:"Config,omitempty"`
}

PluginDetail specify results from the ListPlugins function.

See https://goo.gl/C4t7Tz for more details.

type PluginEnv added in v1.2.0

type PluginEnv struct {
	Name        string   `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
	Description string   `json:"Description,omitempty" yaml:"Description,omitempty" toml:"Description,omitempty"`
	Settable    []string `json:"Settable,omitempty" yaml:"Settable,omitempty" toml:"Settable,omitempty"`
	Value       string   `json:"Value,omitempty" yaml:"Value,omitempty" toml:"Value,omitempty"`
}

PluginEnv stores plugin environment.

See https://goo.gl/C4t7Tz for more details.

type PluginInterface added in v1.2.0

type PluginInterface struct {
	Types  []string `json:"Types,omitempty" yaml:"Types,omitempty" toml:"Types,omitempty"`
	Socket string   `json:"Socket,omitempty" yaml:"Socket,omitempty" toml:"Socket,omitempty"`
}

PluginInterface stores plugin interface.

See https://goo.gl/C4t7Tz for more details.

type PluginLinux added in v1.2.0

type PluginLinux struct {
	Capabilities    []string             `json:"Capabilities,omitempty" yaml:"Capabilities,omitempty" toml:"Capabilities,omitempty"`
	AllowAllDevices bool                 `json:"AllowAllDevices,omitempty" yaml:"AllowAllDevices,omitempty" toml:"AllowAllDevices,omitempty"`
	Devices         []PluginLinuxDevices `json:"Devices,omitempty" yaml:"Devices,omitempty" toml:"Devices,omitempty"`
}

PluginLinux stores plugin linux setting.

See https://goo.gl/C4t7Tz for more details.

type PluginLinuxDevices added in v1.2.0

type PluginLinuxDevices struct {
	Name        string   `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
	Description string   `json:"Documentation,omitempty" yaml:"Documentation,omitempty" toml:"Documentation,omitempty"`
	Settable    []string `json:"Settable,omitempty" yaml:"Settable,omitempty" toml:"Settable,omitempty"`
	Path        string   `json:"Path,omitempty" yaml:"Path,omitempty" toml:"Path,omitempty"`
}

PluginLinuxDevices stores plugin linux device setting.

See https://goo.gl/C4t7Tz for more details.

type PluginNetwork added in v1.2.0

type PluginNetwork struct {
	Type string `json:"Type,omitempty" yaml:"Type,omitempty" toml:"Type,omitempty"`
}

PluginNetwork stores plugin network type.

See https://goo.gl/C4t7Tz for more details.

type PluginPrivilege added in v1.2.0

type PluginPrivilege struct {
	Name        string   `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
	Description string   `json:"Description,omitempty" yaml:"Description,omitempty" toml:"Description,omitempty"`
	Value       []string `json:"Value,omitempty" yaml:"Value,omitempty" toml:"Value,omitempty"`
}

PluginPrivilege represents a privilege for a plugin.

type PluginSettings added in v1.2.0

type PluginSettings struct {
	Env     []string `json:"Env,omitempty" yaml:"Env,omitempty" toml:"Env,omitempty"`
	Args    []string `json:"Args,omitempty" yaml:"Args,omitempty" toml:"Args,omitempty"`
	Devices []string `json:"Devices,omitempty" yaml:"Devices,omitempty" toml:"Devices,omitempty"`
}

PluginSettings stores plugin settings.

See https://goo.gl/C4t7Tz for more details.

type PluginUser added in v1.2.0

type PluginUser struct {
	UID int32 `json:"UID,omitempty" yaml:"UID,omitempty" toml:"UID,omitempty"`
	GID int32 `json:"GID,omitempty" yaml:"GID,omitempty" toml:"GID,omitempty"`
}

PluginUser stores plugin user.

See https://goo.gl/C4t7Tz for more details.

type PluginsInfo

type PluginsInfo struct {
	// List of Volume plugins registered
	Volume []string
	// List of Network plugins registered
	Network []string
	// List of Authorization plugins registered
	Authorization []string
}

PluginsInfo is a struct with the plugins registered with the docker daemon

for more information, see: https://goo.gl/bHUoz9

type Port

type Port string

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

func (Port) Port

func (p Port) Port() string

Port returns the number of the port.

func (Port) Proto

func (p Port) Proto() string

Proto returns the name of the protocol.

type PortBinding

type PortBinding struct {
	HostIP   string `json:"HostIp,omitempty" yaml:"HostIp,omitempty" toml:"HostIp,omitempty"`
	HostPort string `json:"HostPort,omitempty" yaml:"HostPort,omitempty" toml:"HostPort,omitempty"`
}

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

type PortMapping

type PortMapping map[string]string

PortMapping represents a deprecated field in the `docker inspect` output, and its value as found in NetworkSettings should always be nil

type PruneContainersOptions

type PruneContainersOptions struct {
	Filters map[string][]string
	Context context.Context
}

PruneContainersOptions specify parameters to the PruneContainers function.

See https://goo.gl/wnkgDT for more details.

type PruneContainersResults

type PruneContainersResults struct {
	ContainersDeleted []string
	SpaceReclaimed    int64
}

PruneContainersResults specify results from the PruneContainers function.

See https://goo.gl/wnkgDT for more details.

type PruneImagesOptions

type PruneImagesOptions struct {
	Filters map[string][]string
	Context context.Context
}

PruneImagesOptions specify parameters to the PruneImages function.

See https://goo.gl/qfZlbZ for more details.

type PruneImagesResults

type PruneImagesResults struct {
	ImagesDeleted  []struct{ Untagged, Deleted string }
	SpaceReclaimed int64
}

PruneImagesResults specify results from the PruneImages function.

See https://goo.gl/qfZlbZ for more details.

type PruneNetworksOptions

type PruneNetworksOptions struct {
	Filters map[string][]string
	Context context.Context
}

PruneNetworksOptions specify parameters to the PruneNetworks function.

See https://goo.gl/kX0S9h for more details.

type PruneNetworksResults

type PruneNetworksResults struct {
	NetworksDeleted []string
}

PruneNetworksResults specify results from the PruneNetworks function.

See https://goo.gl/kX0S9h for more details.

type PruneVolumesOptions

type PruneVolumesOptions struct {
	Filters map[string][]string
	Context context.Context
}

PruneVolumesOptions specify parameters to the PruneVolumes function.

See https://goo.gl/f9XDem for more details.

type PruneVolumesResults

type PruneVolumesResults struct {
	VolumesDeleted []string
	SpaceReclaimed int64
}

PruneVolumesResults specify results from the PruneVolumes function.

See https://goo.gl/f9XDem for more details.

type PullImageOptions

type PullImageOptions struct {
	Repository string `qs:"fromImage"`
	Tag        string

	// Only required for Docker Engine 1.9 or 1.10 w/ Remote API < 1.21
	// and Docker Engine < 1.9
	// This parameter was removed in Docker Engine 1.11
	Registry string

	OutputStream      io.Writer     `qs:"-"`
	RawJSONStream     bool          `qs:"-"`
	InactivityTimeout time.Duration `qs:"-"`
	Context           context.Context
}

PullImageOptions present the set of options available for pulling an image from a registry.

See https://goo.gl/qkoSsn for more details.

type PushImageOptions

type PushImageOptions struct {
	// Name of the image
	Name string

	// Tag of the image
	Tag string

	// Registry server to push the image
	Registry string

	OutputStream      io.Writer     `qs:"-"`
	RawJSONStream     bool          `qs:"-"`
	InactivityTimeout time.Duration `qs:"-"`

	Context context.Context
}

PushImageOptions represents options to use in the PushImage method.

See https://goo.gl/BZemGg for more details.

type PushPluginOptions added in v1.2.0

type PushPluginOptions struct {
	// The Name of the plugin.
	Name string

	Context context.Context
}

PushPluginOptions specify parameters to PushPlugin function.

See https://goo.gl/C4t7Tz for more details.

type RemoveConfigOptions added in v1.1.0

type RemoveConfigOptions struct {
	ID      string `qs:"-"`
	Context context.Context
}

RemoveConfigOptions encapsulates options to remove a config.

See https://goo.gl/Tqrtya for more details.

type RemoveContainerOptions

type RemoveContainerOptions struct {
	// The ID of the container.
	ID string `qs:"-"`

	// A flag that indicates whether Docker should remove the volumes
	// associated to the container.
	RemoveVolumes bool `qs:"v"`

	// A flag that indicates whether Docker should remove the container
	// even if it is currently running.
	Force   bool
	Context context.Context
}

RemoveContainerOptions encapsulates options to remove a container.

See https://goo.gl/hL5IPC for more details.

type RemoveImageOptions

type RemoveImageOptions struct {
	Force   bool `qs:"force"`
	NoPrune bool `qs:"noprune"`
	Context context.Context
}

RemoveImageOptions present the set of options available for removing an image from a registry.

See https://goo.gl/Vd2Pck for more details.

type RemoveNodeOptions

type RemoveNodeOptions struct {
	ID      string
	Force   bool
	Context context.Context
}

RemoveNodeOptions specify parameters to the RemoveNode function.

See http://goo.gl/0SNvYg for more details.

type RemovePluginOptions added in v1.2.0

type RemovePluginOptions struct {
	// The Name of the plugin.
	Name string `qs:"-"`

	Force   bool `qs:"force"`
	Context context.Context
}

RemovePluginOptions specify parameters to the RemovePlugin function.

See https://goo.gl/C4t7Tz for more details.

type RemoveSecretOptions added in v1.1.0

type RemoveSecretOptions struct {
	ID      string `qs:"-"`
	Context context.Context
}

RemoveSecretOptions encapsulates options to remove a secret.

See https://goo.gl/Tqrtya for more details.

type RemoveServiceOptions

type RemoveServiceOptions struct {
	ID      string `qs:"-"`
	Context context.Context
}

RemoveServiceOptions encapsulates options to remove a service.

See https://goo.gl/Tqrtya for more details.

type RemoveVolumeOptions added in v1.2.1

type RemoveVolumeOptions struct {
	Context context.Context
	Name    string `qs:"-"`
	Force   bool
}

RemoveVolumeOptions specify parameters to the RemoveVolumeWithOptions function.

See https://goo.gl/nvd6qj for more details.

type RenameContainerOptions

type RenameContainerOptions struct {
	// ID of container to rename
	ID string `qs:"-"`

	// New name
	Name    string `json:"name,omitempty" yaml:"name,omitempty"`
	Context context.Context
}

RenameContainerOptions specify parameters to the RenameContainer function.

See https://goo.gl/46inai for more details.

type RestartPolicy

type RestartPolicy struct {
	Name              string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
	MaximumRetryCount int    `json:"MaximumRetryCount,omitempty" yaml:"MaximumRetryCount,omitempty" toml:"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

func AlwaysRestart

func AlwaysRestart() RestartPolicy

AlwaysRestart returns a restart policy that tells the Docker daemon to always restart the container.

func NeverRestart

func NeverRestart() RestartPolicy

NeverRestart returns a restart policy that tells the Docker daemon to never restart the container on failures.

func RestartOnFailure

func RestartOnFailure(maxRetry int) RestartPolicy

RestartOnFailure returns a restart policy that tells the Docker daemon to restart the container on failures, trying at most maxRetry times.

func RestartUnlessStopped

func RestartUnlessStopped() RestartPolicy

RestartUnlessStopped returns a restart policy that tells the Docker daemon to always restart the container except when user has manually stopped the container.

type RootFS

type RootFS struct {
	Type   string   `json:"Type,omitempty" yaml:"Type,omitempty" toml:"Type,omitempty"`
	Layers []string `json:"Layers,omitempty" yaml:"Layers,omitempty" toml:"Layers,omitempty"`
}

RootFS represents the underlying layers used by an image

type Runtime added in v1.3.7

type Runtime struct {
	Path string
	Args []string `json:"runtimeArgs"`
}

Runtime describes an OCI runtime

for more information, see: https://dockr.ly/2NKM8qq

type ServiceConfig

type ServiceConfig struct {
	InsecureRegistryCIDRs []*NetIPNet
	IndexConfigs          map[string]*IndexInfo
	Mirrors               []string
}

ServiceConfig stores daemon registry services configuration.

for more information, see: https://goo.gl/7iFFDz

type Signal

type Signal int

Signal represents a signal that can be send to the container on KillContainer call.

type StartExecOptions

type StartExecOptions struct {
	InputStream  io.Reader `qs:"-"`
	OutputStream io.Writer `qs:"-"`
	ErrorStream  io.Writer `qs:"-"`

	Detach bool `json:"Detach,omitempty" yaml:"Detach,omitempty" toml:"Detach,omitempty"`
	Tty    bool `json:"Tty,omitempty" yaml:"Tty,omitempty" toml:"Tty,omitempty"`

	// Use raw terminal? Usually true when the container contains a TTY.
	RawTerminal bool `qs:"-"`

	// If set, after a successful connect, a sentinel will be sent and then the
	// client will block on receive before continuing.
	//
	// It must be an unbuffered channel. Using a buffered channel can lead
	// to unexpected behavior.
	Success chan struct{} `json:"-"`

	Context context.Context `json:"-"`
}

StartExecOptions specify parameters to the StartExecContainer function.

See https://goo.gl/1EeDWi for more details

type State

type State struct {
	Status            string    `json:"Status,omitempty" yaml:"Status,omitempty" toml:"Status,omitempty"`
	Running           bool      `json:"Running,omitempty" yaml:"Running,omitempty" toml:"Running,omitempty"`
	Paused            bool      `json:"Paused,omitempty" yaml:"Paused,omitempty" toml:"Paused,omitempty"`
	Restarting        bool      `json:"Restarting,omitempty" yaml:"Restarting,omitempty" toml:"Restarting,omitempty"`
	OOMKilled         bool      `json:"OOMKilled,omitempty" yaml:"OOMKilled,omitempty" toml:"OOMKilled,omitempty"`
	RemovalInProgress bool      `json:"RemovalInProgress,omitempty" yaml:"RemovalInProgress,omitempty" toml:"RemovalInProgress,omitempty"`
	Dead              bool      `json:"Dead,omitempty" yaml:"Dead,omitempty" toml:"Dead,omitempty"`
	Pid               int       `json:"Pid,omitempty" yaml:"Pid,omitempty" toml:"Pid,omitempty"`
	ExitCode          int       `json:"ExitCode,omitempty" yaml:"ExitCode,omitempty" toml:"ExitCode,omitempty"`
	Error             string    `json:"Error,omitempty" yaml:"Error,omitempty" toml:"Error,omitempty"`
	StartedAt         time.Time `json:"StartedAt,omitempty" yaml:"StartedAt,omitempty" toml:"StartedAt,omitempty"`
	FinishedAt        time.Time `json:"FinishedAt,omitempty" yaml:"FinishedAt,omitempty" toml:"FinishedAt,omitempty"`
	Health            Health    `json:"Health,omitempty" yaml:"Health,omitempty" toml:"Health,omitempty"`
}

State represents the state of a container.

func (*State) StateString

func (s *State) StateString() string

StateString returns a single string to describe state

func (*State) String

func (s *State) String() string

String returns a human-readable description of the state

type Stats

type Stats struct {
	Read      time.Time `json:"read,omitempty" yaml:"read,omitempty" toml:"read,omitempty"`
	PreRead   time.Time `json:"preread,omitempty" yaml:"preread,omitempty" toml:"preread,omitempty"`
	NumProcs  uint32    `json:"num_procs" yaml:"num_procs" toml:"num_procs"`
	PidsStats struct {
		Current uint64 `json:"current,omitempty" yaml:"current,omitempty"`
	} `json:"pids_stats,omitempty" yaml:"pids_stats,omitempty" toml:"pids_stats,omitempty"`
	Network     NetworkStats            `json:"network,omitempty" yaml:"network,omitempty" toml:"network,omitempty"`
	Networks    map[string]NetworkStats `json:"networks,omitempty" yaml:"networks,omitempty" toml:"networks,omitempty"`
	MemoryStats struct {
		Stats struct {
			TotalPgmafault          uint64 `json:"total_pgmafault,omitempty" yaml:"total_pgmafault,omitempty" toml:"total_pgmafault,omitempty"`
			Cache                   uint64 `json:"cache,omitempty" yaml:"cache,omitempty" toml:"cache,omitempty"`
			MappedFile              uint64 `json:"mapped_file,omitempty" yaml:"mapped_file,omitempty" toml:"mapped_file,omitempty"`
			TotalInactiveFile       uint64 `json:"total_inactive_file,omitempty" yaml:"total_inactive_file,omitempty" toml:"total_inactive_file,omitempty"`
			Pgpgout                 uint64 `json:"pgpgout,omitempty" yaml:"pgpgout,omitempty" toml:"pgpgout,omitempty"`
			Rss                     uint64 `json:"rss,omitempty" yaml:"rss,omitempty" toml:"rss,omitempty"`
			TotalMappedFile         uint64 `json:"total_mapped_file,omitempty" yaml:"total_mapped_file,omitempty" toml:"total_mapped_file,omitempty"`
			Writeback               uint64 `json:"writeback,omitempty" yaml:"writeback,omitempty" toml:"writeback,omitempty"`
			Unevictable             uint64 `json:"unevictable,omitempty" yaml:"unevictable,omitempty" toml:"unevictable,omitempty"`
			Pgpgin                  uint64 `json:"pgpgin,omitempty" yaml:"pgpgin,omitempty" toml:"pgpgin,omitempty"`
			TotalUnevictable        uint64 `json:"total_unevictable,omitempty" yaml:"total_unevictable,omitempty" toml:"total_unevictable,omitempty"`
			Pgmajfault              uint64 `json:"pgmajfault,omitempty" yaml:"pgmajfault,omitempty" toml:"pgmajfault,omitempty"`
			TotalRss                uint64 `json:"total_rss,omitempty" yaml:"total_rss,omitempty" toml:"total_rss,omitempty"`
			TotalRssHuge            uint64 `json:"total_rss_huge,omitempty" yaml:"total_rss_huge,omitempty" toml:"total_rss_huge,omitempty"`
			TotalWriteback          uint64 `json:"total_writeback,omitempty" yaml:"total_writeback,omitempty" toml:"total_writeback,omitempty"`
			TotalInactiveAnon       uint64 `json:"total_inactive_anon,omitempty" yaml:"total_inactive_anon,omitempty" toml:"total_inactive_anon,omitempty"`
			RssHuge                 uint64 `json:"rss_huge,omitempty" yaml:"rss_huge,omitempty" toml:"rss_huge,omitempty"`
			HierarchicalMemoryLimit uint64 `` /* 128-byte string literal not displayed */
			TotalPgfault            uint64 `json:"total_pgfault,omitempty" yaml:"total_pgfault,omitempty" toml:"total_pgfault,omitempty"`
			TotalActiveFile         uint64 `json:"total_active_file,omitempty" yaml:"total_active_file,omitempty" toml:"total_active_file,omitempty"`
			ActiveAnon              uint64 `json:"active_anon,omitempty" yaml:"active_anon,omitempty" toml:"active_anon,omitempty"`
			TotalActiveAnon         uint64 `json:"total_active_anon,omitempty" yaml:"total_active_anon,omitempty" toml:"total_active_anon,omitempty"`
			TotalPgpgout            uint64 `json:"total_pgpgout,omitempty" yaml:"total_pgpgout,omitempty" toml:"total_pgpgout,omitempty"`
			TotalCache              uint64 `json:"total_cache,omitempty" yaml:"total_cache,omitempty" toml:"total_cache,omitempty"`
			InactiveAnon            uint64 `json:"inactive_anon,omitempty" yaml:"inactive_anon,omitempty" toml:"inactive_anon,omitempty"`
			ActiveFile              uint64 `json:"active_file,omitempty" yaml:"active_file,omitempty" toml:"active_file,omitempty"`
			Pgfault                 uint64 `json:"pgfault,omitempty" yaml:"pgfault,omitempty" toml:"pgfault,omitempty"`
			InactiveFile            uint64 `json:"inactive_file,omitempty" yaml:"inactive_file,omitempty" toml:"inactive_file,omitempty"`
			TotalPgpgin             uint64 `json:"total_pgpgin,omitempty" yaml:"total_pgpgin,omitempty" toml:"total_pgpgin,omitempty"`
			HierarchicalMemswLimit  uint64 `json:"hierarchical_memsw_limit,omitempty" yaml:"hierarchical_memsw_limit,omitempty" toml:"hierarchical_memsw_limit,omitempty"`
			Swap                    uint64 `json:"swap,omitempty" yaml:"swap,omitempty" toml:"swap,omitempty"`
		} `json:"stats,omitempty" yaml:"stats,omitempty" toml:"stats,omitempty"`
		MaxUsage          uint64 `json:"max_usage,omitempty" yaml:"max_usage,omitempty" toml:"max_usage,omitempty"`
		Usage             uint64 `json:"usage,omitempty" yaml:"usage,omitempty" toml:"usage,omitempty"`
		Failcnt           uint64 `json:"failcnt,omitempty" yaml:"failcnt,omitempty" toml:"failcnt,omitempty"`
		Limit             uint64 `json:"limit,omitempty" yaml:"limit,omitempty" toml:"limit,omitempty"`
		Commit            uint64 `json:"commitbytes,omitempty" yaml:"commitbytes,omitempty" toml:"privateworkingset,omitempty"`
		CommitPeak        uint64 `json:"commitpeakbytes,omitempty" yaml:"commitpeakbytes,omitempty" toml:"commitpeakbytes,omitempty"`
		PrivateWorkingSet uint64 `json:"privateworkingset,omitempty" yaml:"privateworkingset,omitempty" toml:"privateworkingset,omitempty"`
	} `json:"memory_stats,omitempty" yaml:"memory_stats,omitempty" toml:"memory_stats,omitempty"`
	BlkioStats struct {
		IOServiceBytesRecursive []BlkioStatsEntry `` /* 131-byte string literal not displayed */
		IOServicedRecursive     []BlkioStatsEntry `json:"io_serviced_recursive,omitempty" yaml:"io_serviced_recursive,omitempty" toml:"io_serviced_recursive,omitempty"`
		IOQueueRecursive        []BlkioStatsEntry `json:"io_queue_recursive,omitempty" yaml:"io_queue_recursive,omitempty" toml:"io_queue_recursive,omitempty"`
		IOServiceTimeRecursive  []BlkioStatsEntry `` /* 128-byte string literal not displayed */
		IOWaitTimeRecursive     []BlkioStatsEntry `json:"io_wait_time_recursive,omitempty" yaml:"io_wait_time_recursive,omitempty" toml:"io_wait_time_recursive,omitempty"`
		IOMergedRecursive       []BlkioStatsEntry `json:"io_merged_recursive,omitempty" yaml:"io_merged_recursive,omitempty" toml:"io_merged_recursive,omitempty"`
		IOTimeRecursive         []BlkioStatsEntry `json:"io_time_recursive,omitempty" yaml:"io_time_recursive,omitempty" toml:"io_time_recursive,omitempty"`
		SectorsRecursive        []BlkioStatsEntry `json:"sectors_recursive,omitempty" yaml:"sectors_recursive,omitempty" toml:"sectors_recursive,omitempty"`
	} `json:"blkio_stats,omitempty" yaml:"blkio_stats,omitempty" toml:"blkio_stats,omitempty"`
	CPUStats     CPUStats `json:"cpu_stats,omitempty" yaml:"cpu_stats,omitempty" toml:"cpu_stats,omitempty"`
	PreCPUStats  CPUStats `json:"precpu_stats,omitempty"`
	StorageStats struct {
		ReadCountNormalized  uint64 `json:"read_count_normalized,omitempty" yaml:"read_count_normalized,omitempty" toml:"read_count_normalized,omitempty"`
		ReadSizeBytes        uint64 `json:"read_size_bytes,omitempty" yaml:"read_size_bytes,omitempty" toml:"read_size_bytes,omitempty"`
		WriteCountNormalized uint64 `json:"write_count_normalized,omitempty" yaml:"write_count_normalized,omitempty" toml:"write_count_normalized,omitempty"`
		WriteSizeBytes       uint64 `json:"write_size_bytes,omitempty" yaml:"write_size_bytes,omitempty" toml:"write_size_bytes,omitempty"`
	} `json:"storage_stats,omitempty" yaml:"storage_stats,omitempty" toml:"storage_stats,omitempty"`
}

Stats represents container statistics, returned by /containers/<id>/stats.

See https://goo.gl/Dk3Xio for more details.

type StatsOptions

type StatsOptions struct {
	ID     string
	Stats  chan<- *Stats
	Stream bool
	// A flag that enables stopping the stats operation
	Done <-chan bool
	// Initial connection timeout
	Timeout time.Duration
	// Timeout with no data is received, it's reset every time new data
	// arrives
	InactivityTimeout time.Duration `qs:"-"`
	Context           context.Context
}

StatsOptions specify parameters to the Stats function.

See https://goo.gl/Dk3Xio for more details.

type SwarmNode

type SwarmNode struct {
	ID     string            `json:"ID,omitempty" yaml:"ID,omitempty" toml:"ID,omitempty"`
	IP     string            `json:"IP,omitempty" yaml:"IP,omitempty" toml:"IP,omitempty"`
	Addr   string            `json:"Addr,omitempty" yaml:"Addr,omitempty" toml:"Addr,omitempty"`
	Name   string            `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
	CPUs   int64             `json:"CPUs,omitempty" yaml:"CPUs,omitempty" toml:"CPUs,omitempty"`
	Memory int64             `json:"Memory,omitempty" yaml:"Memory,omitempty" toml:"Memory,omitempty"`
	Labels map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty" toml:"Labels,omitempty"`
}

SwarmNode containers information about which Swarm node the container is on.

type TagImageOptions

type TagImageOptions struct {
	Repo    string
	Tag     string
	Force   bool
	Context context.Context
}

TagImageOptions present the set of options to tag an image.

See https://goo.gl/prHrvo for more details.

type TempfsOptions

type TempfsOptions struct {
	SizeBytes int64 `json:"SizeBytes,omitempty" yaml:"SizeBytes,omitempty" toml:"SizeBytes,omitempty"`
	Mode      int   `json:"Mode,omitempty" yaml:"Mode,omitempty" toml:"Mode,omitempty"`
}

TempfsOptions contains optional configuration for the tempfs type

type TopResult

type TopResult struct {
	Titles    []string
	Processes [][]string
}

TopResult represents the list of processes running in a container, as returned by /containers/<id>/top.

See https://goo.gl/FLwpPl for more details.

type ULimit

type ULimit struct {
	Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
	Soft int64  `json:"Soft,omitempty" yaml:"Soft,omitempty" toml:"Soft,omitempty"`
	Hard int64  `json:"Hard,omitempty" yaml:"Hard,omitempty" toml:"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 UpdateConfigOptions added in v1.1.0

type UpdateConfigOptions struct {
	Auth AuthConfiguration `qs:"-"`
	swarm.ConfigSpec
	Context context.Context
	Version uint64
}

UpdateConfigOptions specify parameters to the UpdateConfig function.

See https://goo.gl/wu3MmS for more details.

type UpdateContainerOptions

type UpdateContainerOptions struct {
	BlkioWeight        int           `json:"BlkioWeight"`
	CPUShares          int           `json:"CpuShares"`
	CPUPeriod          int           `json:"CpuPeriod"`
	CPURealtimePeriod  int64         `json:"CpuRealtimePeriod"`
	CPURealtimeRuntime int64         `json:"CpuRealtimeRuntime"`
	CPUQuota           int           `json:"CpuQuota"`
	CpusetCpus         string        `json:"CpusetCpus"`
	CpusetMems         string        `json:"CpusetMems"`
	Memory             int           `json:"Memory"`
	MemorySwap         int           `json:"MemorySwap"`
	MemoryReservation  int           `json:"MemoryReservation"`
	KernelMemory       int           `json:"KernelMemory"`
	RestartPolicy      RestartPolicy `json:"RestartPolicy,omitempty"`
	Context            context.Context
}

UpdateContainerOptions specify parameters to the UpdateContainer function.

See https://goo.gl/Y6fXUy for more details.

type UpdateNodeOptions

type UpdateNodeOptions struct {
	swarm.NodeSpec
	Version uint64
	Context context.Context
}

UpdateNodeOptions specify parameters to the NodeUpdate function.

See http://goo.gl/VPBFgA for more details.

type UpdateSecretOptions added in v1.1.0

type UpdateSecretOptions struct {
	Auth AuthConfiguration `qs:"-"`
	swarm.SecretSpec
	Context context.Context
	Version uint64
}

UpdateSecretOptions specify parameters to the UpdateSecret function.

Only label can be updated See https://docs.docker.com/engine/api/v1.33/#operation/SecretUpdate See https://goo.gl/wu3MmS for more details.

type UpdateServiceOptions

type UpdateServiceOptions struct {
	Auth              AuthConfiguration `qs:"-"`
	swarm.ServiceSpec `qs:"-"`
	Context           context.Context
	Version           uint64
	Rollback          string
}

UpdateServiceOptions specify parameters to the UpdateService function.

See https://goo.gl/wu3MmS for more details.

type UpdateSwarmOptions

type UpdateSwarmOptions struct {
	Version            int
	RotateWorkerToken  bool
	RotateManagerToken bool
	Swarm              swarm.Spec
	Context            context.Context
}

UpdateSwarmOptions specify parameters to the UpdateSwarm function. See https://goo.gl/vFbq36 for more details.

type UploadToContainerOptions

type UploadToContainerOptions struct {
	InputStream          io.Reader `json:"-" qs:"-"`
	Path                 string    `qs:"path"`
	NoOverwriteDirNonDir bool      `qs:"noOverwriteDirNonDir"`
	Context              context.Context
}

UploadToContainerOptions is the set of options that can be used when uploading an archive into a container.

See https://goo.gl/g25o7u for more details.

type Volume

type Volume struct {
	Name       string            `json:"Name" yaml:"Name" toml:"Name"`
	Driver     string            `json:"Driver,omitempty" yaml:"Driver,omitempty" toml:"Driver,omitempty"`
	Mountpoint string            `json:"Mountpoint,omitempty" yaml:"Mountpoint,omitempty" toml:"Mountpoint,omitempty"`
	Labels     map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty" toml:"Labels,omitempty"`
	Options    map[string]string `json:"Options,omitempty" yaml:"Options,omitempty" toml:"Options,omitempty"`
	CreatedAt  time.Time         `json:"CreatedAt,omitempty" yaml:"CreatedAt,omitempty" toml:"CreatedAt,omitempty"`
}

Volume represents a volume.

See https://goo.gl/3wgTsd for more details.

type VolumeDriverConfig

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

VolumeDriverConfig holds a map of volume driver specific options

type VolumeOptions

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

VolumeOptions contains optional configuration for the volume type

type VolumeUsageData added in v1.3.7

type VolumeUsageData struct {

	// The number of containers referencing this volume. This field
	// is set to `-1` if the reference-count is not available.
	//
	// Required: true
	RefCount int64 `json:"RefCount"`

	// Amount of disk space used by the volume (in bytes). This information
	// is only available for volumes created with the `"local"` volume
	// driver. For volumes created with other volume drivers, this field
	// is set to `-1` ("not available")
	//
	// Required: true
	Size int64 `json:"Size"`
}

VolumeUsageData represents usage data from the docker system api More Info Here https://dockr.ly/2PNzQyO

Directories

Path Synopsis
internal
Package testing provides a fake implementation of the Docker API, useful for testing purpose.
Package testing provides a fake implementation of the Docker API, useful for testing purpose.

Jump to

Keyboard shortcuts

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