 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- type Actor
- type AttachOptions
- type AuthConfig
- type BlkioStatEntry
- type BlkioStats
- type BuildImage
- type Callback
- type Client
- type ConfigFile
- type Container
- type ContainerChanges
- type ContainerConfig
- type ContainerInfo
- type CpuStats
- type CpuUsage
- type DeviceMapping
- type DockerClient
- func (client *DockerClient) AttachContainer(id string, options *AttachOptions) (io.ReadCloser, error)
- func (client *DockerClient) BuildImage(image *BuildImage) (io.ReadCloser, error)
- func (client *DockerClient) ConnectNetwork(id, container string) error
- func (client *DockerClient) ContainerChanges(id string) ([]*ContainerChanges, error)
- func (client *DockerClient) ContainerLogs(id string, options *LogOptions) (io.ReadCloser, error)
- func (client *DockerClient) CreateContainer(config *ContainerConfig, name string, auth *AuthConfig) (string, error)
- func (client *DockerClient) CreateNetwork(config *NetworkCreate) (*NetworkCreateResponse, error)
- func (client *DockerClient) CreateVolume(request *VolumeCreateRequest) (*Volume, error)
- func (client *DockerClient) DisconnectNetwork(id, container string, force bool) error
- func (client *DockerClient) ExecCreate(config *ExecConfig) (string, error)
- func (client *DockerClient) ExecResize(id string, width, height int) error
- func (client *DockerClient) ExecStart(id string, config *ExecConfig) error
- func (client *DockerClient) ImportImage(source string, repository string, tag string, tar io.Reader) (io.ReadCloser, error)
- func (client *DockerClient) Info() (*Info, error)
- func (client *DockerClient) InspectContainer(id string) (*ContainerInfo, error)
- func (client *DockerClient) InspectImage(id string) (*ImageInfo, error)
- func (client *DockerClient) InspectNetwork(id string) (*NetworkResource, error)
- func (client *DockerClient) KillContainer(id, signal string) error
- func (client *DockerClient) ListContainers(all bool, size bool, filters string) ([]Container, error)
- func (client *DockerClient) ListImages(all bool) ([]*Image, error)
- func (client *DockerClient) ListNetworks(filters string) ([]*NetworkResource, error)
- func (client *DockerClient) ListVolumes() ([]*Volume, error)
- func (client *DockerClient) LoadImage(reader io.Reader) error
- func (client *DockerClient) MonitorEvents(options *MonitorEventsOptions, stopChan <-chan struct{}) (<-chan EventOrError, error)
- func (client *DockerClient) PauseContainer(id string) error
- func (client *DockerClient) PullImage(name string, auth *AuthConfig) error
- func (client *DockerClient) PushImage(name string, tag string, auth *AuthConfig) error
- func (client *DockerClient) RemoveContainer(id string, force, volumes bool) error
- func (client *DockerClient) RemoveImage(name string, force bool) ([]*ImageDelete, error)
- func (client *DockerClient) RemoveNetwork(id string) error
- func (client *DockerClient) RemoveVolume(name string) error
- func (client *DockerClient) RenameContainer(oldName string, newName string) error
- func (client *DockerClient) RestartContainer(id string, timeout int) error
- func (client *DockerClient) StartContainer(id string, config *HostConfig) error
- func (client *DockerClient) StartMonitorEvents(cb Callback, ec chan error, args ...interface{})
- func (client *DockerClient) StartMonitorStats(id string, cb StatCallback, ec chan error, args ...interface{})
- func (client *DockerClient) StopAllMonitorEvents()
- func (client *DockerClient) StopAllMonitorStats()
- func (client *DockerClient) StopContainer(id string, timeout int) error
- func (client *DockerClient) TagImage(nameOrID string, repo string, tag string, force bool) error
- func (client *DockerClient) UnpauseContainer(id string) error
- func (client *DockerClient) Version() (*Version, error)
- func (client *DockerClient) Wait(id string) <-chan WaitResult
 
- type EndpointResource
- type EndpointSettings
- type Error
- type Event
- type EventOrError
- type ExecConfig
- type HostConfig
- type IPAM
- type IPAMConfig
- type Image
- type ImageDelete
- type ImageInfo
- type Info
- type LogConfig
- type LogOptions
- type MemoryStats
- type MonitorEventsFilters
- type MonitorEventsOptions
- type NetworkConnect
- type NetworkCreate
- type NetworkCreateResponse
- type NetworkDisconnect
- type NetworkResource
- type NetworkStats
- type Port
- type PortBinding
- type RespContainersCreate
- type RestartPolicy
- type StatCallback
- type State
- type Stats
- type ThrottlingData
- type Ulimit
- type Version
- type Volume
- type VolumeCreateRequest
- type VolumesListResponse
- type WaitResult
Examples ¶
Constants ¶
const (
	APIVersion = "v1.15"
)
    Variables ¶
Functions ¶
This section is empty.
Types ¶
type AttachOptions ¶
type AuthConfig ¶
type AuthConfig struct {
	Username      string `json:"username,omitempty"`
	Password      string `json:"password,omitempty"`
	Email         string `json:"email,omitempty"`
	RegistryToken string `json:"registrytoken,omitempty"`
}
    AuthConfig hold parameters for authenticating with the docker registry
type BlkioStatEntry ¶
type BlkioStats ¶
type BlkioStats struct {
	// number of bytes tranferred to and from the block device
	IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive"`
	IoServicedRecursive     []BlkioStatEntry `json:"io_serviced_recursive"`
	IoQueuedRecursive       []BlkioStatEntry `json:"io_queue_recursive"`
	IoServiceTimeRecursive  []BlkioStatEntry `json:"io_service_time_recursive"`
	IoWaitTimeRecursive     []BlkioStatEntry `json:"io_wait_time_recursive"`
	IoMergedRecursive       []BlkioStatEntry `json:"io_merged_recursive"`
	IoTimeRecursive         []BlkioStatEntry `json:"io_time_recursive"`
	SectorsRecursive        []BlkioStatEntry `json:"sectors_recursive"`
}
    type BuildImage ¶
type BuildImage struct {
	Config         *ConfigFile
	DockerfileName string
	Context        io.Reader
	RemoteURL      string
	RepoName       string
	SuppressOutput bool
	NoCache        bool
	Remove         bool
	ForceRemove    bool
	Pull           bool
	Memory         int64
	MemorySwap     int64
	CpuPeriod      int64
	CpuQuota       int64
	CpuSetCpus     string
	CpuSetMems     string
	CgroupParent   string
	BuildArgs      map[string]string
}
    type Client ¶
type Client interface {
	Info() (*Info, error)
	ListContainers(all, size bool, filters string) ([]Container, error)
	InspectContainer(id string) (*ContainerInfo, error)
	InspectImage(id string) (*ImageInfo, error)
	CreateContainer(config *ContainerConfig, name string, authConfig *AuthConfig) (string, error)
	ContainerLogs(id string, options *LogOptions) (io.ReadCloser, error)
	ContainerChanges(id string) ([]*ContainerChanges, error)
	ExecCreate(config *ExecConfig) (string, error)
	ExecStart(id string, config *ExecConfig) error
	ExecResize(id string, width, height int) error
	StartContainer(id string, config *HostConfig) error
	AttachContainer(id string, options *AttachOptions) (io.ReadCloser, error)
	StopContainer(id string, timeout int) error
	RestartContainer(id string, timeout int) error
	KillContainer(id, signal string) error
	Wait(id string) <-chan WaitResult
	// MonitorEvents takes options and an optional stop channel, and returns
	// an EventOrError channel. If an error is ever sent, then no more
	// events will be sent. If a stop channel is provided, events will stop
	// being monitored after the stop channel is closed.
	MonitorEvents(options *MonitorEventsOptions, stopChan <-chan struct{}) (<-chan EventOrError, error)
	StartMonitorEvents(cb Callback, ec chan error, args ...interface{})
	StopAllMonitorEvents()
	StartMonitorStats(id string, cb StatCallback, ec chan error, args ...interface{})
	StopAllMonitorStats()
	TagImage(nameOrID string, repo string, tag string, force bool) error
	Version() (*Version, error)
	PullImage(name string, auth *AuthConfig) error
	PushImage(name string, tag string, auth *AuthConfig) error
	LoadImage(reader io.Reader) error
	RemoveContainer(id string, force, volumes bool) error
	ListImages(all bool) ([]*Image, error)
	RemoveImage(name string, force bool) ([]*ImageDelete, error)
	PauseContainer(name string) error
	UnpauseContainer(name string) error
	RenameContainer(oldName string, newName string) error
	ImportImage(source string, repository string, tag string, tar io.Reader) (io.ReadCloser, error)
	BuildImage(image *BuildImage) (io.ReadCloser, error)
	ListVolumes() ([]*Volume, error)
	RemoveVolume(name string) error
	CreateVolume(request *VolumeCreateRequest) (*Volume, error)
	ListNetworks(filters string) ([]*NetworkResource, error)
	InspectNetwork(id string) (*NetworkResource, error)
	CreateNetwork(config *NetworkCreate) (*NetworkCreateResponse, error)
	ConnectNetwork(id, container string) error
	DisconnectNetwork(id, container string, force bool) error
	RemoveNetwork(id string) error
}
    type ConfigFile ¶
type ConfigFile struct {
	Configs map[string]AuthConfig `json:"configs,omitempty"`
	// contains filtered or unexported fields
}
    ConfigFile holds parameters for authenticating during a BuildImage request
type Container ¶
type ContainerConfig ¶
type ContainerConfig struct {
	Hostname        string
	Domainname      string
	User            string
	AttachStdin     bool
	AttachStdout    bool
	AttachStderr    bool
	ExposedPorts    map[string]struct{}
	Tty             bool
	OpenStdin       bool
	StdinOnce       bool
	Env             []string
	Cmd             []string
	Image           string
	Volumes         map[string]struct{}
	WorkingDir      string
	Entrypoint      []string
	NetworkDisabled bool
	MacAddress      string
	OnBuild         []string
	Labels          map[string]string
	StopSignal      string
	// FIXME: VolumeDriver have been removed since docker 1.9
	VolumeDriver string
	// FIXME: The following fields have been removed since API v1.18
	Memory     int64
	MemorySwap int64
	Cpuset     string
	PortSpecs  []string
	// This is used only by the create command
	HostConfig HostConfig
}
    type ContainerInfo ¶
type ContainerInfo struct {
	Id              string
	Created         string
	Path            string
	Name            string
	Args            []string
	ExecIDs         []string
	Config          *ContainerConfig
	State           *State
	Image           string
	NetworkSettings struct {
		EndpointSettings
		IPAddress   string `json:"IpAddress"`
		IPPrefixLen int    `json:"IpPrefixLen"`
		Gateway     string
		Bridge      string
		Networks    map[string]EndpointSettings
		Ports       map[string][]PortBinding
	}
	SysInitPath    string
	ResolvConfPath string
	Volumes        map[string]string
	HostConfig     *HostConfig
}
    type CpuStats ¶
type CpuStats struct {
	CpuUsage       CpuUsage       `json:"cpu_usage"`
	SystemUsage    uint64         `json:"system_cpu_usage"`
	ThrottlingData ThrottlingData `json:"throttling_data,omitempty"`
}
    type CpuUsage ¶
type CpuUsage struct {
	// Total CPU time consumed.
	// Units: nanoseconds.
	TotalUsage uint64 `json:"total_usage"`
	// Total CPU time consumed per core.
	// Units: nanoseconds.
	PercpuUsage []uint64 `json:"percpu_usage"`
	// Time spent by tasks of the cgroup in kernel mode.
	// Units: nanoseconds.
	UsageInKernelmode uint64 `json:"usage_in_kernelmode"`
	// Time spent by tasks of the cgroup in user mode.
	// Units: nanoseconds.
	UsageInUsermode uint64 `json:"usage_in_usermode"`
}
    type DeviceMapping ¶
type DockerClient ¶
type DockerClient struct {
	URL        *url.URL
	HTTPClient *http.Client
	TLSConfig  *tls.Config
	// contains filtered or unexported fields
}
    func NewDockerClient ¶
func NewDockerClient(daemonUrl string, tlsConfig *tls.Config) (*DockerClient, error)
func NewDockerClientTimeout ¶
func (*DockerClient) AttachContainer ¶
func (client *DockerClient) AttachContainer(id string, options *AttachOptions) (io.ReadCloser, error)
Example ¶
docker, err := NewDockerClient("unix:///var/run/docker.sock", nil)
if err != nil {
	panic(err)
}
cID, err := docker.CreateContainer(&ContainerConfig{
	Cmd:   []string{"echo", "hi"},
	Image: "busybox",
}, "", nil)
if err != nil {
	panic(err)
}
done := make(chan struct{})
if body, err := docker.AttachContainer(cID, &AttachOptions{
	Stream: true,
	Stdout: true,
}); err != nil {
	panic(err)
} else {
	go func() {
		defer body.Close()
		if _, err := stdcopy.StdCopy(os.Stdout, os.Stderr, body); err != nil {
			panic(err)
		}
		close(done)
	}()
}
if err := docker.StartContainer(cID, nil); err != nil {
	panic(err)
}
<-done
func (*DockerClient) BuildImage ¶
func (client *DockerClient) BuildImage(image *BuildImage) (io.ReadCloser, error)
func (*DockerClient) ConnectNetwork ¶
func (client *DockerClient) ConnectNetwork(id, container string) error
func (*DockerClient) ContainerChanges ¶
func (client *DockerClient) ContainerChanges(id string) ([]*ContainerChanges, error)
func (*DockerClient) ContainerLogs ¶
func (client *DockerClient) ContainerLogs(id string, options *LogOptions) (io.ReadCloser, error)
func (*DockerClient) CreateContainer ¶
func (client *DockerClient) CreateContainer(config *ContainerConfig, name string, auth *AuthConfig) (string, error)
func (*DockerClient) CreateNetwork ¶
func (client *DockerClient) CreateNetwork(config *NetworkCreate) (*NetworkCreateResponse, error)
func (*DockerClient) CreateVolume ¶
func (client *DockerClient) CreateVolume(request *VolumeCreateRequest) (*Volume, error)
func (*DockerClient) DisconnectNetwork ¶
func (client *DockerClient) DisconnectNetwork(id, container string, force bool) error
func (*DockerClient) ExecCreate ¶
func (client *DockerClient) ExecCreate(config *ExecConfig) (string, error)
func (*DockerClient) ExecResize ¶
func (client *DockerClient) ExecResize(id string, width, height int) error
func (*DockerClient) ExecStart ¶
func (client *DockerClient) ExecStart(id string, config *ExecConfig) error
func (*DockerClient) ImportImage ¶
func (client *DockerClient) ImportImage(source string, repository string, tag string, tar io.Reader) (io.ReadCloser, error)
func (*DockerClient) Info ¶
func (client *DockerClient) Info() (*Info, error)
func (*DockerClient) InspectContainer ¶
func (client *DockerClient) InspectContainer(id string) (*ContainerInfo, error)
func (*DockerClient) InspectImage ¶
func (client *DockerClient) InspectImage(id string) (*ImageInfo, error)
func (*DockerClient) InspectNetwork ¶
func (client *DockerClient) InspectNetwork(id string) (*NetworkResource, error)
func (*DockerClient) KillContainer ¶
func (client *DockerClient) KillContainer(id, signal string) error
func (*DockerClient) ListContainers ¶
func (*DockerClient) ListImages ¶
func (client *DockerClient) ListImages(all bool) ([]*Image, error)
func (*DockerClient) ListNetworks ¶
func (client *DockerClient) ListNetworks(filters string) ([]*NetworkResource, error)
func (*DockerClient) ListVolumes ¶
func (client *DockerClient) ListVolumes() ([]*Volume, error)
func (*DockerClient) LoadImage ¶
func (client *DockerClient) LoadImage(reader io.Reader) error
func (*DockerClient) MonitorEvents ¶
func (client *DockerClient) MonitorEvents(options *MonitorEventsOptions, stopChan <-chan struct{}) (<-chan EventOrError, error)
func (*DockerClient) PauseContainer ¶
func (client *DockerClient) PauseContainer(id string) error
func (*DockerClient) PullImage ¶
func (client *DockerClient) PullImage(name string, auth *AuthConfig) error
func (*DockerClient) PushImage ¶
func (client *DockerClient) PushImage(name string, tag string, auth *AuthConfig) error
func (*DockerClient) RemoveContainer ¶
func (client *DockerClient) RemoveContainer(id string, force, volumes bool) error
func (*DockerClient) RemoveImage ¶
func (client *DockerClient) RemoveImage(name string, force bool) ([]*ImageDelete, error)
func (*DockerClient) RemoveNetwork ¶
func (client *DockerClient) RemoveNetwork(id string) error
func (*DockerClient) RemoveVolume ¶
func (client *DockerClient) RemoveVolume(name string) error
func (*DockerClient) RenameContainer ¶
func (client *DockerClient) RenameContainer(oldName string, newName string) error
func (*DockerClient) RestartContainer ¶
func (client *DockerClient) RestartContainer(id string, timeout int) error
func (*DockerClient) StartContainer ¶
func (client *DockerClient) StartContainer(id string, config *HostConfig) error
func (*DockerClient) StartMonitorEvents ¶
func (client *DockerClient) StartMonitorEvents(cb Callback, ec chan error, args ...interface{})
func (*DockerClient) StartMonitorStats ¶
func (client *DockerClient) StartMonitorStats(id string, cb StatCallback, ec chan error, args ...interface{})
func (*DockerClient) StopAllMonitorEvents ¶
func (client *DockerClient) StopAllMonitorEvents()
func (*DockerClient) StopAllMonitorStats ¶
func (client *DockerClient) StopAllMonitorStats()
func (*DockerClient) StopContainer ¶
func (client *DockerClient) StopContainer(id string, timeout int) error
func (*DockerClient) TagImage ¶
func (*DockerClient) UnpauseContainer ¶
func (client *DockerClient) UnpauseContainer(id string) error
func (*DockerClient) Version ¶
func (client *DockerClient) Version() (*Version, error)
func (*DockerClient) Wait ¶
func (client *DockerClient) Wait(id string) <-chan WaitResult
type EndpointResource ¶
type EndpointResource struct {
	Name        string
	EndpointID  string
	MacAddress  string
	IPv4Address string
	IPv6Address string
}
    EndpointResource contains network resources allocated and used for a container in a network
type EndpointSettings ¶
type Error ¶
type Event ¶
type ExecConfig ¶
type HostConfig ¶
type HostConfig struct {
	Binds             []string
	ContainerIDFile   string
	LxcConf           []map[string]string
	Memory            int64
	MemoryReservation int64
	MemorySwap        int64
	KernelMemory      int64
	CpuPeriod         int64
	CpusetCpus        string
	CpusetMems        string
	CpuQuota          int64
	BlkioWeight       int64
	OomKillDisable    bool
	MemorySwappiness  int64
	Privileged        bool
	PortBindings      map[string][]PortBinding
	Links             []string
	PublishAllPorts   bool
	Dns               []string
	DNSOptions        []string
	DnsSearch         []string
	ExtraHosts        []string
	VolumesFrom       []string
	Devices           []DeviceMapping
	NetworkMode       string
	IpcMode           string
	PidMode           string
	UTSMode           string
	CapAdd            []string
	CapDrop           []string
	GroupAdd          []string
	RestartPolicy     RestartPolicy
	SecurityOpt       []string
	ReadonlyRootfs    bool
	Ulimits           []Ulimit
	LogConfig         LogConfig
	CgroupParent      string
	ConsoleSize       [2]int
	VolumeDriver      string
}
    type IPAM ¶
type IPAM struct {
	Driver string
	Config []IPAMConfig
}
    IPAM represents IP Address Management
type IPAMConfig ¶
type IPAMConfig struct {
	Subnet     string            `json:",omitempty"`
	IPRange    string            `json:",omitempty"`
	Gateway    string            `json:",omitempty"`
	AuxAddress map[string]string `json:"AuxiliaryAddresses,omitempty"`
}
    IPAMConfig represents IPAM configurations
type Image ¶
type ImageInfo ¶
type Info ¶
type Info struct {
	ID                 string
	Containers         int64
	Driver             string
	DriverStatus       [][]string
	ExecutionDriver    string
	Images             int64
	KernelVersion      string
	OperatingSystem    string
	NCPU               int64
	MemTotal           int64
	Name               string
	Labels             []string
	Debug              interface{}
	NFd                int64
	NGoroutines        int64
	SystemTime         string
	NEventsListener    int64
	InitPath           string
	InitSha1           string
	IndexServerAddress string
	MemoryLimit        interface{}
	SwapLimit          interface{}
	IPv4Forwarding     interface{}
	BridgeNfIptables   bool
	BridgeNfIp6tables  bool
	DockerRootDir      string
	HttpProxy          string
	HttpsProxy         string
	NoProxy            string
}
    Info is the struct returned by /info The API is currently in flux, so Debug, MemoryLimit, SwapLimit, and IPv4Forwarding are interfaces because in docker 1.6.1 they are 0 or 1 but in master they are bools.
type LogConfig ¶
type LogOptions ¶
type MemoryStats ¶
type MonitorEventsFilters ¶
type MonitorEventsOptions ¶
type MonitorEventsOptions struct {
	Since   int
	Until   int
	Filters *MonitorEventsFilters `json:",omitempty"`
}
    type NetworkConnect ¶
type NetworkConnect struct {
	Container string
}
    NetworkConnect represents the data to be used to connect a container to the network
type NetworkCreate ¶
type NetworkCreate struct {
	Name           string
	CheckDuplicate bool
	Driver         string
	IPAM           IPAM
	Options        map[string]string
}
    NetworkCreate is the expected body of the "create network" http request message
type NetworkCreateResponse ¶
NetworkCreateResponse is the response message sent by the server for network create call
type NetworkDisconnect ¶
NetworkDisconnect represents the data to be used to disconnect a container from the network
type NetworkResource ¶
type NetworkResource struct {
	Name       string
	ID         string `json:"Id"`
	Scope      string
	Driver     string
	IPAM       IPAM
	Containers map[string]EndpointResource
	Options    map[string]string
}
    NetworkResource is the body of the "get network" http response message
type NetworkStats ¶
type NetworkStats struct {
	RxBytes   uint64 `json:"rx_bytes"`
	RxPackets uint64 `json:"rx_packets"`
	RxErrors  uint64 `json:"rx_errors"`
	RxDropped uint64 `json:"rx_dropped"`
	TxBytes   uint64 `json:"tx_bytes"`
	TxPackets uint64 `json:"tx_packets"`
	TxErrors  uint64 `json:"tx_errors"`
	TxDropped uint64 `json:"tx_dropped"`
}
    type State ¶
type State struct {
	Running    bool
	Paused     bool
	Restarting bool
	OOMKilled  bool
	Dead       bool
	Pid        int
	ExitCode   int
	Error      string // contains last known error when starting the container
	StartedAt  time.Time
	FinishedAt time.Time
	Ghost      bool
}
    func (*State) StateString ¶
StateString returns a single string to describe state Stoken from docker/docker/daemon/state.go
type Stats ¶
type Stats struct {
	Read         time.Time    `json:"read"`
	NetworkStats NetworkStats `json:"network,omitempty"`
	CpuStats     CpuStats     `json:"cpu_stats,omitempty"`
	MemoryStats  MemoryStats  `json:"memory_stats,omitempty"`
	BlkioStats   BlkioStats   `json:"blkio_stats,omitempty"`
}
    type ThrottlingData ¶
type ThrottlingData struct {
	// Number of periods with throttling active
	Periods uint64 `json:"periods"`
	// Number of periods when the container hit its throttling limit.
	ThrottledPeriods uint64 `json:"throttled_periods"`
	// Aggregate time the container was throttled for in nanoseconds.
	ThrottledTime uint64 `json:"throttled_time"`
}
    The following are types for the API stats endpoint
type Ulimit ¶
type Version ¶
type Volume ¶
type VolumeCreateRequest ¶
       Source Files
      ¶
      Source Files
      ¶
    
- auth.go
- dockerclient.go
- example_responses.go
- interface.go
- types.go
- utils.go
