2015-02-24 14:12:47 -05:00
|
|
|
package types
|
|
|
|
|
2015-04-13 10:17:14 -04:00
|
|
|
import (
|
2015-05-12 21:21:26 -04:00
|
|
|
"os"
|
2015-04-13 10:17:14 -04:00
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/docker/docker/daemon/network"
|
2015-10-26 22:35:49 -04:00
|
|
|
"github.com/docker/docker/pkg/nat"
|
2015-04-13 10:17:14 -04:00
|
|
|
"github.com/docker/docker/pkg/version"
|
2015-09-07 19:29:33 -04:00
|
|
|
"github.com/docker/docker/registry"
|
2015-04-13 10:17:14 -04:00
|
|
|
"github.com/docker/docker/runconfig"
|
|
|
|
)
|
2015-04-16 15:48:04 -04:00
|
|
|
|
2015-02-24 14:12:47 -05:00
|
|
|
// ContainerCreateResponse contains the information returned to a client on the
|
|
|
|
// creation of a new container.
|
|
|
|
type ContainerCreateResponse struct {
|
|
|
|
// ID is the ID of the created container.
|
|
|
|
ID string `json:"Id"`
|
|
|
|
|
|
|
|
// Warnings are any warnings encountered during the creation of the container.
|
|
|
|
Warnings []string `json:"Warnings"`
|
|
|
|
}
|
2015-03-23 17:03:54 -04:00
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// ContainerExecCreateResponse contains response of Remote API:
|
|
|
|
// POST "/containers/{name:.*}/exec"
|
2015-03-23 17:03:54 -04:00
|
|
|
type ContainerExecCreateResponse struct {
|
|
|
|
// ID is the exec ID.
|
|
|
|
ID string `json:"Id"`
|
|
|
|
}
|
2015-03-23 18:32:50 -04:00
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// AuthResponse contains response of Remote API:
|
|
|
|
// POST "/auth"
|
2015-03-23 18:32:50 -04:00
|
|
|
type AuthResponse struct {
|
|
|
|
// Status is the authentication status
|
|
|
|
Status string `json:"Status"`
|
|
|
|
}
|
2015-03-25 23:01:14 -04:00
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// ContainerWaitResponse contains response of Remote API:
|
2015-03-26 00:22:45 -04:00
|
|
|
// POST "/containers/"+containerID+"/wait"
|
2015-03-25 23:01:14 -04:00
|
|
|
type ContainerWaitResponse struct {
|
|
|
|
// StatusCode is the status code of the wait job
|
|
|
|
StatusCode int `json:"StatusCode"`
|
|
|
|
}
|
2015-03-28 12:39:24 -04:00
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// ContainerCommitResponse contains response of Remote API:
|
2015-03-28 12:39:24 -04:00
|
|
|
// POST "/commit?container="+containerID
|
|
|
|
type ContainerCommitResponse struct {
|
|
|
|
ID string `json:"Id"`
|
|
|
|
}
|
2015-04-02 18:52:34 -04:00
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// ContainerChange contains response of Remote API:
|
2015-04-02 18:52:34 -04:00
|
|
|
// GET "/containers/{name:.*}/changes"
|
|
|
|
type ContainerChange struct {
|
|
|
|
Kind int
|
|
|
|
Path string
|
|
|
|
}
|
2015-04-03 11:31:30 -04:00
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// ImageHistory contains response of Remote API:
|
2015-04-03 11:31:30 -04:00
|
|
|
// GET "/images/{name:.*}/history"
|
|
|
|
type ImageHistory struct {
|
|
|
|
ID string `json:"Id"`
|
2015-05-14 20:31:34 -04:00
|
|
|
Created int64
|
2015-04-03 11:31:30 -04:00
|
|
|
CreatedBy string
|
|
|
|
Tags []string
|
|
|
|
Size int64
|
2015-01-04 01:47:01 -05:00
|
|
|
Comment string
|
2015-04-03 11:31:30 -04:00
|
|
|
}
|
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// ImageDelete contains response of Remote API:
|
2015-04-03 11:31:30 -04:00
|
|
|
// DELETE "/images/{name:.*}"
|
|
|
|
type ImageDelete struct {
|
|
|
|
Untagged string `json:",omitempty"`
|
|
|
|
Deleted string `json:",omitempty"`
|
|
|
|
}
|
2015-04-03 20:39:06 -04:00
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// Image contains response of Remote API:
|
2015-04-03 20:39:06 -04:00
|
|
|
// GET "/images/json"
|
|
|
|
type Image struct {
|
|
|
|
ID string `json:"Id"`
|
2015-07-23 05:40:54 -04:00
|
|
|
ParentID string `json:"ParentId"`
|
2015-04-03 20:39:06 -04:00
|
|
|
RepoTags []string
|
|
|
|
RepoDigests []string
|
2015-07-23 17:19:58 -04:00
|
|
|
Created int64
|
|
|
|
Size int64
|
|
|
|
VirtualSize int64
|
2015-04-03 20:39:06 -04:00
|
|
|
Labels map[string]string
|
|
|
|
}
|
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// GraphDriverData returns Image's graph driver config info
|
|
|
|
// when calling inspect command
|
2015-06-15 14:05:10 -04:00
|
|
|
type GraphDriverData struct {
|
|
|
|
Name string
|
|
|
|
Data map[string]string
|
|
|
|
}
|
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// ImageInspect contains response of Remote API:
|
2015-03-26 15:43:00 -04:00
|
|
|
// GET "/images/{name:.*}/json"
|
|
|
|
type ImageInspect struct {
|
2015-07-23 05:40:54 -04:00
|
|
|
ID string `json:"Id"`
|
2015-10-22 06:34:12 -04:00
|
|
|
RepoTags []string
|
|
|
|
RepoDigests []string
|
2015-03-26 15:43:00 -04:00
|
|
|
Parent string
|
|
|
|
Comment string
|
2015-07-26 09:00:53 -04:00
|
|
|
Created string
|
2015-03-26 15:43:00 -04:00
|
|
|
Container string
|
|
|
|
ContainerConfig *runconfig.Config
|
|
|
|
DockerVersion string
|
|
|
|
Author string
|
|
|
|
Config *runconfig.Config
|
|
|
|
Architecture string
|
|
|
|
Os string
|
|
|
|
Size int64
|
|
|
|
VirtualSize int64
|
2015-06-15 14:05:10 -04:00
|
|
|
GraphDriver GraphDriverData
|
2015-03-26 15:43:00 -04:00
|
|
|
}
|
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// Port stores open ports info of container
|
|
|
|
// e.g. {"PrivatePort": 8080, "PublicPort": 80, "Type": "tcp"}
|
2015-04-03 20:39:06 -04:00
|
|
|
type Port struct {
|
2015-06-12 12:49:53 -04:00
|
|
|
IP string `json:",omitempty"`
|
2015-04-03 20:39:06 -04:00
|
|
|
PrivatePort int
|
2015-06-12 12:49:53 -04:00
|
|
|
PublicPort int `json:",omitempty"`
|
2015-04-03 20:39:06 -04:00
|
|
|
Type string
|
|
|
|
}
|
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// Container contains response of Remote API:
|
|
|
|
// GET "/containers/json"
|
2015-04-03 20:39:06 -04:00
|
|
|
type Container struct {
|
2015-06-03 12:23:14 -04:00
|
|
|
ID string `json:"Id"`
|
|
|
|
Names []string
|
|
|
|
Image string
|
2015-10-02 10:48:35 -04:00
|
|
|
ImageID string
|
2015-06-03 12:23:14 -04:00
|
|
|
Command string
|
2015-07-23 17:19:58 -04:00
|
|
|
Created int64
|
2015-06-03 12:23:14 -04:00
|
|
|
Ports []Port
|
2015-07-23 17:19:58 -04:00
|
|
|
SizeRw int64 `json:",omitempty"`
|
|
|
|
SizeRootFs int64 `json:",omitempty"`
|
2015-06-03 12:23:14 -04:00
|
|
|
Labels map[string]string
|
|
|
|
Status string
|
2015-06-22 02:14:33 -04:00
|
|
|
HostConfig struct {
|
|
|
|
NetworkMode string `json:",omitempty"`
|
|
|
|
}
|
2015-04-03 20:39:06 -04:00
|
|
|
}
|
2015-04-09 16:05:31 -04:00
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// CopyConfig contains request body of Remote API:
|
2015-04-09 16:05:31 -04:00
|
|
|
// POST "/containers/"+containerID+"/copy"
|
|
|
|
type CopyConfig struct {
|
|
|
|
Resource string
|
|
|
|
}
|
2015-04-09 18:13:01 -04:00
|
|
|
|
2015-05-13 18:01:51 -04:00
|
|
|
// ContainerPathStat is used to encode the header from
|
2015-07-23 05:40:54 -04:00
|
|
|
// GET "/containers/{name:.*}/archive"
|
|
|
|
// "Name" is the file or directory name.
|
2015-05-12 21:21:26 -04:00
|
|
|
type ContainerPathStat struct {
|
2015-07-24 17:12:55 -04:00
|
|
|
Name string `json:"name"`
|
|
|
|
Size int64 `json:"size"`
|
|
|
|
Mode os.FileMode `json:"mode"`
|
|
|
|
Mtime time.Time `json:"mtime"`
|
|
|
|
LinkTarget string `json:"linkTarget"`
|
2015-05-12 21:21:26 -04:00
|
|
|
}
|
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// ContainerProcessList contains response of Remote API:
|
2015-04-09 18:13:01 -04:00
|
|
|
// GET "/containers/{name:.*}/top"
|
|
|
|
type ContainerProcessList struct {
|
|
|
|
Processes [][]string
|
|
|
|
Titles []string
|
|
|
|
}
|
2015-04-16 15:48:04 -04:00
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// Version contains response of Remote API:
|
|
|
|
// GET "/version"
|
2015-04-16 15:48:04 -04:00
|
|
|
type Version struct {
|
|
|
|
Version string
|
2015-07-23 05:40:54 -04:00
|
|
|
APIVersion version.Version `json:"ApiVersion"`
|
2015-04-16 15:48:04 -04:00
|
|
|
GitCommit string
|
|
|
|
GoVersion string
|
|
|
|
Os string
|
|
|
|
Arch string
|
|
|
|
KernelVersion string `json:",omitempty"`
|
2015-06-03 19:56:09 -04:00
|
|
|
Experimental bool `json:",omitempty"`
|
2015-06-19 13:03:13 -04:00
|
|
|
BuildTime string `json:",omitempty"`
|
2015-04-16 15:48:04 -04:00
|
|
|
}
|
2015-04-10 13:26:30 -04:00
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// Info contains response of Remote API:
|
2015-04-10 13:26:30 -04:00
|
|
|
// GET "/info"
|
|
|
|
type Info struct {
|
|
|
|
ID string
|
|
|
|
Containers int
|
|
|
|
Images int
|
|
|
|
Driver string
|
|
|
|
DriverStatus [][2]string
|
|
|
|
MemoryLimit bool
|
|
|
|
SwapLimit bool
|
2015-07-23 05:40:54 -04:00
|
|
|
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
|
|
|
|
CPUCfsQuota bool `json:"CpuCfsQuota"`
|
2015-04-10 13:26:30 -04:00
|
|
|
IPv4Forwarding bool
|
2015-06-16 21:19:11 -04:00
|
|
|
BridgeNfIptables bool
|
2015-07-23 05:40:54 -04:00
|
|
|
BridgeNfIP6tables bool `json:"BridgeNfIp6tables"`
|
2015-04-10 13:26:30 -04:00
|
|
|
Debug bool
|
|
|
|
NFd int
|
2015-02-26 06:53:55 -05:00
|
|
|
OomKillDisable bool
|
2015-04-10 13:26:30 -04:00
|
|
|
NGoroutines int
|
|
|
|
SystemTime string
|
|
|
|
ExecutionDriver string
|
|
|
|
LoggingDriver string
|
|
|
|
NEventsListener int
|
|
|
|
KernelVersion string
|
|
|
|
OperatingSystem string
|
|
|
|
IndexServerAddress string
|
2015-09-07 19:29:33 -04:00
|
|
|
RegistryConfig *registry.ServiceConfig
|
2015-04-10 13:26:30 -04:00
|
|
|
InitSha1 string
|
|
|
|
InitPath string
|
|
|
|
NCPU int
|
|
|
|
MemTotal int64
|
|
|
|
DockerRootDir string
|
2015-07-23 05:40:54 -04:00
|
|
|
HTTPProxy string `json:"HttpProxy"`
|
|
|
|
HTTPSProxy string `json:"HttpsProxy"`
|
2015-04-10 13:26:30 -04:00
|
|
|
NoProxy string
|
|
|
|
Name string
|
|
|
|
Labels []string
|
2015-05-19 18:09:58 -04:00
|
|
|
ExperimentalBuild bool
|
2015-09-21 00:23:54 -04:00
|
|
|
ServerVersion string
|
2015-09-10 19:12:00 -04:00
|
|
|
ClusterStore string
|
2015-10-25 20:12:22 -04:00
|
|
|
ClusterAdvertise string
|
2015-04-10 13:26:30 -04:00
|
|
|
}
|
2015-04-17 01:36:23 -04:00
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// ExecStartCheck is a temp struct used by execStart
|
2015-04-17 01:36:23 -04:00
|
|
|
// Config fields is part of ExecConfig in runconfig package
|
|
|
|
type ExecStartCheck struct {
|
|
|
|
// ExecStart will first check if it's detached
|
|
|
|
Detach bool
|
|
|
|
// Check if there's a tty
|
|
|
|
Tty bool
|
|
|
|
}
|
2015-04-13 10:17:14 -04:00
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// ContainerState stores container's running state
|
|
|
|
// it's part of ContainerJSONBase and will return by "inspect" command
|
2015-04-13 10:17:14 -04:00
|
|
|
type ContainerState struct {
|
2015-07-27 20:48:27 -04:00
|
|
|
Status string
|
2015-04-13 10:17:14 -04:00
|
|
|
Running bool
|
|
|
|
Paused bool
|
|
|
|
Restarting bool
|
|
|
|
OOMKilled bool
|
|
|
|
Dead bool
|
|
|
|
Pid int
|
|
|
|
ExitCode int
|
|
|
|
Error string
|
2015-07-26 09:00:53 -04:00
|
|
|
StartedAt string
|
|
|
|
FinishedAt string
|
2015-04-13 10:17:14 -04:00
|
|
|
}
|
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// ContainerJSONBase contains response of Remote API:
|
2015-04-13 10:17:14 -04:00
|
|
|
// GET "/containers/{name:.*}/json"
|
2015-06-02 17:37:59 -04:00
|
|
|
type ContainerJSONBase struct {
|
2015-07-23 05:40:54 -04:00
|
|
|
ID string `json:"Id"`
|
2015-07-26 09:00:53 -04:00
|
|
|
Created string
|
2015-04-13 10:17:14 -04:00
|
|
|
Path string
|
|
|
|
Args []string
|
|
|
|
State *ContainerState
|
|
|
|
Image string
|
|
|
|
ResolvConfPath string
|
|
|
|
HostnamePath string
|
|
|
|
HostsPath string
|
|
|
|
LogPath string
|
|
|
|
Name string
|
|
|
|
RestartCount int
|
|
|
|
Driver string
|
|
|
|
MountLabel string
|
|
|
|
ProcessLabel string
|
|
|
|
AppArmorProfile string
|
|
|
|
ExecIDs []string
|
|
|
|
HostConfig *runconfig.HostConfig
|
2015-06-15 14:05:10 -04:00
|
|
|
GraphDriver GraphDriverData
|
2015-09-25 08:49:02 -04:00
|
|
|
SizeRw *int64 `json:",omitempty"`
|
|
|
|
SizeRootFs *int64 `json:",omitempty"`
|
2015-04-13 10:17:14 -04:00
|
|
|
}
|
2015-06-02 17:37:59 -04:00
|
|
|
|
2015-07-23 05:40:54 -04:00
|
|
|
// ContainerJSON is newly used struct along with MountPoint
|
2015-06-02 17:37:59 -04:00
|
|
|
type ContainerJSON struct {
|
|
|
|
*ContainerJSONBase
|
2015-10-26 22:35:49 -04:00
|
|
|
Mounts []MountPoint
|
|
|
|
Config *runconfig.Config
|
|
|
|
NetworkSettings *NetworkSettings
|
|
|
|
}
|
|
|
|
|
|
|
|
// NetworkSettings exposes the network settings in the api
|
|
|
|
type NetworkSettings struct {
|
|
|
|
NetworkSettingsBase
|
2015-10-30 14:57:15 -04:00
|
|
|
DefaultNetworkSettings
|
2015-10-26 22:35:49 -04:00
|
|
|
Networks map[string]*network.EndpointSettings
|
|
|
|
}
|
|
|
|
|
|
|
|
// NetworkSettingsBase holds basic information about networks
|
|
|
|
type NetworkSettingsBase struct {
|
|
|
|
Bridge string
|
|
|
|
SandboxID string
|
|
|
|
HairpinMode bool
|
|
|
|
LinkLocalIPv6Address string
|
|
|
|
LinkLocalIPv6PrefixLen int
|
|
|
|
Ports nat.PortMap
|
|
|
|
SandboxKey string
|
|
|
|
SecondaryIPAddresses []network.Address
|
|
|
|
SecondaryIPv6Addresses []network.Address
|
2015-06-02 17:37:59 -04:00
|
|
|
}
|
|
|
|
|
2015-10-30 14:57:15 -04:00
|
|
|
// DefaultNetworkSettings holds network information
|
|
|
|
// during the 2 release deprecation period.
|
|
|
|
// It will be removed in Docker 1.11.
|
|
|
|
type DefaultNetworkSettings struct {
|
|
|
|
EndpointID string
|
|
|
|
Gateway string
|
|
|
|
GlobalIPv6Address string
|
|
|
|
GlobalIPv6PrefixLen int
|
|
|
|
IPAddress string
|
|
|
|
IPPrefixLen int
|
|
|
|
IPv6Gateway string
|
|
|
|
MacAddress string
|
|
|
|
}
|
|
|
|
|
2015-06-03 15:21:38 -04:00
|
|
|
// MountPoint represents a mount point configuration inside the container.
|
|
|
|
type MountPoint struct {
|
|
|
|
Name string `json:",omitempty"`
|
|
|
|
Source string
|
|
|
|
Destination string
|
|
|
|
Driver string `json:",omitempty"`
|
2015-07-22 09:24:35 -04:00
|
|
|
Mode string
|
2015-06-03 15:21:38 -04:00
|
|
|
RW bool
|
|
|
|
}
|
2015-06-12 09:25:32 -04:00
|
|
|
|
|
|
|
// Volume represents the configuration of a volume for the remote API
|
|
|
|
type Volume struct {
|
|
|
|
Name string // Name is the name of the volume
|
|
|
|
Driver string // Driver is the Driver name used to create the volume
|
|
|
|
Mountpoint string // Mountpoint is the location on disk of the volume
|
|
|
|
}
|
|
|
|
|
|
|
|
// VolumesListResponse contains the response for the remote API:
|
|
|
|
// GET "/volumes"
|
|
|
|
type VolumesListResponse struct {
|
|
|
|
Volumes []*Volume // Volumes is the list of volumes being returned
|
|
|
|
}
|
|
|
|
|
|
|
|
// VolumeCreateRequest contains the response for the remote API:
|
2015-10-17 07:49:14 -04:00
|
|
|
// POST "/volumes/create"
|
2015-06-12 09:25:32 -04:00
|
|
|
type VolumeCreateRequest struct {
|
|
|
|
Name string // Name is the requested name of the volume
|
|
|
|
Driver string // Driver is the name of the driver that should be used to create the volume
|
|
|
|
DriverOpts map[string]string // DriverOpts holds the driver specific options to use for when creating the volume.
|
|
|
|
}
|
2015-09-25 06:19:17 -04:00
|
|
|
|
|
|
|
// NetworkResource is the body of the "get network" http response message
|
|
|
|
type NetworkResource struct {
|
2015-10-30 13:54:16 -04:00
|
|
|
Name string
|
|
|
|
ID string `json:"Id"`
|
|
|
|
Scope string
|
|
|
|
Driver string
|
|
|
|
IPAM network.IPAM
|
|
|
|
Containers map[string]EndpointResource
|
|
|
|
Options map[string]string
|
2015-09-25 06:19:17 -04:00
|
|
|
}
|
|
|
|
|
2015-11-05 01:17:37 -05:00
|
|
|
// EndpointResource contains network resources allocated and used for a container in a network
|
2015-09-25 06:19:17 -04:00
|
|
|
type EndpointResource struct {
|
2015-10-30 13:54:16 -04:00
|
|
|
EndpointID string
|
|
|
|
MacAddress string
|
|
|
|
IPv4Address string
|
|
|
|
IPv6Address string
|
2015-09-25 06:19:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// NetworkCreate is the expected body of the "create network" http request message
|
|
|
|
type NetworkCreate struct {
|
2015-10-30 13:54:16 -04:00
|
|
|
Name string
|
|
|
|
CheckDuplicate bool
|
|
|
|
Driver string
|
|
|
|
IPAM network.IPAM
|
|
|
|
Options map[string]string
|
2015-09-25 06:19:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// NetworkCreateResponse is the response message sent by the server for network create call
|
|
|
|
type NetworkCreateResponse struct {
|
2015-10-30 13:54:16 -04:00
|
|
|
ID string `json:"Id"`
|
|
|
|
Warning string
|
2015-09-25 06:19:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// NetworkConnect represents the data to be used to connect a container to the network
|
|
|
|
type NetworkConnect struct {
|
2015-10-30 13:54:16 -04:00
|
|
|
Container string
|
2015-09-25 06:19:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// NetworkDisconnect represents the data to be used to disconnect a container from the network
|
|
|
|
type NetworkDisconnect struct {
|
2015-10-30 13:54:16 -04:00
|
|
|
Container string
|
2015-09-25 06:19:17 -04:00
|
|
|
}
|