2015-02-24 22:12:47 +03:00
|
|
|
package types
|
|
|
|
|
2015-04-13 17:17:14 +03:00
|
|
|
import (
|
2015-05-13 04:21:26 +03:00
|
|
|
"os"
|
2015-04-13 17:17:14 +03:00
|
|
|
"time"
|
|
|
|
|
2016-01-05 02:26:13 +03:00
|
|
|
"github.com/docker/engine-api/types/container"
|
2016-07-01 18:30:13 +03:00
|
|
|
"github.com/docker/engine-api/types/mount"
|
2016-01-05 02:26:13 +03:00
|
|
|
"github.com/docker/engine-api/types/network"
|
|
|
|
"github.com/docker/engine-api/types/registry"
|
2016-06-07 21:46:47 +03:00
|
|
|
"github.com/docker/engine-api/types/swarm"
|
2015-12-18 20:58:48 +03:00
|
|
|
"github.com/docker/go-connections/nat"
|
2015-04-13 17:17:14 +03:00
|
|
|
)
|
2015-04-16 22:48:04 +03:00
|
|
|
|
2015-02-24 22:12:47 +03: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-24 00:03:54 +03:00
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// ContainerExecCreateResponse contains response of Remote API:
|
|
|
|
// POST "/containers/{name:.*}/exec"
|
2015-03-24 00:03:54 +03:00
|
|
|
type ContainerExecCreateResponse struct {
|
|
|
|
// ID is the exec ID.
|
|
|
|
ID string `json:"Id"`
|
|
|
|
}
|
2015-03-24 01:32:50 +03:00
|
|
|
|
2015-12-28 14:19:26 +03:00
|
|
|
// ContainerUpdateResponse contains response of Remote API:
|
2016-05-20 11:40:35 +03:00
|
|
|
// POST "/containers/{name:.*}/update"
|
2015-12-28 14:19:26 +03:00
|
|
|
type ContainerUpdateResponse struct {
|
|
|
|
// Warnings are any warnings encountered during the updating of the container.
|
|
|
|
Warnings []string `json:"Warnings"`
|
|
|
|
}
|
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// AuthResponse contains response of Remote API:
|
|
|
|
// POST "/auth"
|
2015-03-24 01:32:50 +03:00
|
|
|
type AuthResponse struct {
|
|
|
|
// Status is the authentication status
|
|
|
|
Status string `json:"Status"`
|
2016-02-24 02:50:09 +03:00
|
|
|
|
|
|
|
// IdentityToken is an opaque token used for authenticating
|
|
|
|
// a user after a successful login.
|
|
|
|
IdentityToken string `json:"IdentityToken,omitempty"`
|
2015-03-24 01:32:50 +03:00
|
|
|
}
|
2015-03-26 06:01:14 +03:00
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// ContainerWaitResponse contains response of Remote API:
|
2015-03-26 07:22:45 +03:00
|
|
|
// POST "/containers/"+containerID+"/wait"
|
2015-03-26 06:01:14 +03:00
|
|
|
type ContainerWaitResponse struct {
|
|
|
|
// StatusCode is the status code of the wait job
|
|
|
|
StatusCode int `json:"StatusCode"`
|
|
|
|
}
|
2015-03-28 19:39:24 +03:00
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// ContainerCommitResponse contains response of Remote API:
|
2015-03-28 19:39:24 +03:00
|
|
|
// POST "/commit?container="+containerID
|
|
|
|
type ContainerCommitResponse struct {
|
|
|
|
ID string `json:"Id"`
|
|
|
|
}
|
2015-04-03 01:52:34 +03:00
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// ContainerChange contains response of Remote API:
|
2015-04-03 01:52:34 +03:00
|
|
|
// GET "/containers/{name:.*}/changes"
|
|
|
|
type ContainerChange struct {
|
|
|
|
Kind int
|
|
|
|
Path string
|
|
|
|
}
|
2015-04-03 18:31:30 +03:00
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// ImageHistory contains response of Remote API:
|
2015-04-03 18:31:30 +03:00
|
|
|
// GET "/images/{name:.*}/history"
|
|
|
|
type ImageHistory struct {
|
|
|
|
ID string `json:"Id"`
|
2015-05-15 03:31:34 +03:00
|
|
|
Created int64
|
2015-04-03 18:31:30 +03:00
|
|
|
CreatedBy string
|
|
|
|
Tags []string
|
|
|
|
Size int64
|
2015-01-04 09:47:01 +03:00
|
|
|
Comment string
|
2015-04-03 18:31:30 +03:00
|
|
|
}
|
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// ImageDelete contains response of Remote API:
|
2015-04-03 18:31:30 +03:00
|
|
|
// DELETE "/images/{name:.*}"
|
|
|
|
type ImageDelete struct {
|
|
|
|
Untagged string `json:",omitempty"`
|
|
|
|
Deleted string `json:",omitempty"`
|
|
|
|
}
|
2015-04-04 03:39:06 +03:00
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// Image contains response of Remote API:
|
2016-06-07 22:04:50 +03:00
|
|
|
// GET "/images/json"
|
2015-04-04 03:39:06 +03:00
|
|
|
type Image struct {
|
|
|
|
ID string `json:"Id"`
|
2015-07-23 12:40:54 +03:00
|
|
|
ParentID string `json:"ParentId"`
|
2015-04-04 03:39:06 +03:00
|
|
|
RepoTags []string
|
|
|
|
RepoDigests []string
|
2015-07-24 00:19:58 +03:00
|
|
|
Created int64
|
|
|
|
Size int64
|
|
|
|
VirtualSize int64
|
2015-04-04 03:39:06 +03:00
|
|
|
Labels map[string]string
|
|
|
|
}
|
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// GraphDriverData returns Image's graph driver config info
|
|
|
|
// when calling inspect command
|
2015-06-15 21:05:10 +03:00
|
|
|
type GraphDriverData struct {
|
|
|
|
Name string
|
|
|
|
Data map[string]string
|
|
|
|
}
|
|
|
|
|
2016-03-21 19:55:27 +03:00
|
|
|
// RootFS returns Image's RootFS description including the layer IDs.
|
|
|
|
type RootFS struct {
|
|
|
|
Type string
|
|
|
|
Layers []string `json:",omitempty"`
|
|
|
|
BaseLayer string `json:",omitempty"`
|
|
|
|
}
|
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// ImageInspect contains response of Remote API:
|
2016-06-07 22:04:50 +03:00
|
|
|
// GET "/images/{name:.*}/json"
|
2015-03-26 22:43:00 +03:00
|
|
|
type ImageInspect struct {
|
2015-07-23 12:40:54 +03:00
|
|
|
ID string `json:"Id"`
|
2015-10-22 13:34:12 +03:00
|
|
|
RepoTags []string
|
|
|
|
RepoDigests []string
|
2015-03-26 22:43:00 +03:00
|
|
|
Parent string
|
|
|
|
Comment string
|
2015-07-26 16:00:53 +03:00
|
|
|
Created string
|
2015-03-26 22:43:00 +03:00
|
|
|
Container string
|
2015-12-18 21:36:17 +03:00
|
|
|
ContainerConfig *container.Config
|
2015-03-26 22:43:00 +03:00
|
|
|
DockerVersion string
|
|
|
|
Author string
|
2015-12-18 21:36:17 +03:00
|
|
|
Config *container.Config
|
2015-03-26 22:43:00 +03:00
|
|
|
Architecture string
|
|
|
|
Os string
|
|
|
|
Size int64
|
|
|
|
VirtualSize int64
|
2015-06-15 21:05:10 +03:00
|
|
|
GraphDriver GraphDriverData
|
2016-03-21 19:55:27 +03:00
|
|
|
RootFS RootFS
|
2015-03-26 22:43:00 +03:00
|
|
|
}
|
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// Port stores open ports info of container
|
|
|
|
// e.g. {"PrivatePort": 8080, "PublicPort": 80, "Type": "tcp"}
|
2015-04-04 03:39:06 +03:00
|
|
|
type Port struct {
|
2015-06-12 19:49:53 +03:00
|
|
|
IP string `json:",omitempty"`
|
2015-04-04 03:39:06 +03:00
|
|
|
PrivatePort int
|
2015-06-12 19:49:53 +03:00
|
|
|
PublicPort int `json:",omitempty"`
|
2015-04-04 03:39:06 +03:00
|
|
|
Type string
|
|
|
|
}
|
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// Container contains response of Remote API:
|
2016-06-07 22:04:50 +03:00
|
|
|
// GET "/containers/json"
|
2015-04-04 03:39:06 +03:00
|
|
|
type Container struct {
|
2015-06-03 19:23:14 +03:00
|
|
|
ID string `json:"Id"`
|
|
|
|
Names []string
|
|
|
|
Image string
|
2015-10-02 17:48:35 +03:00
|
|
|
ImageID string
|
2015-06-03 19:23:14 +03:00
|
|
|
Command string
|
2015-07-24 00:19:58 +03:00
|
|
|
Created int64
|
2015-06-03 19:23:14 +03:00
|
|
|
Ports []Port
|
2015-07-24 00:19:58 +03:00
|
|
|
SizeRw int64 `json:",omitempty"`
|
|
|
|
SizeRootFs int64 `json:",omitempty"`
|
2015-06-03 19:23:14 +03:00
|
|
|
Labels map[string]string
|
2016-01-14 14:35:11 +03:00
|
|
|
State string
|
2015-06-03 19:23:14 +03:00
|
|
|
Status string
|
2015-06-22 09:14:33 +03:00
|
|
|
HostConfig struct {
|
|
|
|
NetworkMode string `json:",omitempty"`
|
|
|
|
}
|
Add containers’ networks to /containers/json
After addition of multi-host networking in Docker 1.9, Docker Remote
API is still returning only the network specified during creation
of the container in the “List Containers” (`/containers/json`) endpoint:
...
"HostConfig": {
"NetworkMode": "default"
},
The list of networks containers are attached to is only available at
Get Container (`/containers/<id>/json`) endpoint.
This does not allow applications utilizing multi-host networking to
be built on top of Docker Remote API.
Therefore I added a simple `"NetworkSettings"` section to the
`/containers/json` endpoint. This is not identical to the NetworkSettings
returned in Get Container (`/containers/<id>/json`) endpoint. It only
contains a single field `"Networks"`, which is essentially the same
value shown in inspect output of a container.
This change adds the following section to the `/containers/json`:
"NetworkSettings": {
"Networks": {
"bridge": {
"EndpointID": "2cdc4edb1ded3631c81f57966563e...",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02"
}
}
}
This is of type `SummaryNetworkSettings` type, a minimal version of
`api/types#NetworkSettings`.
Actually all I need is the network name and the IPAddress fields. If folks
find this addition too big, I can create a `SummaryEndpointSettings` field
as well, containing just the IPAddress field.
Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-12-10 07:48:50 +03:00
|
|
|
NetworkSettings *SummaryNetworkSettings
|
2016-02-04 01:12:21 +03:00
|
|
|
Mounts []MountPoint
|
2015-04-04 03:39:06 +03:00
|
|
|
}
|
2015-04-09 23:05:31 +03:00
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// CopyConfig contains request body of Remote API:
|
2015-04-09 23:05:31 +03:00
|
|
|
// POST "/containers/"+containerID+"/copy"
|
|
|
|
type CopyConfig struct {
|
|
|
|
Resource string
|
|
|
|
}
|
2015-04-10 01:13:01 +03:00
|
|
|
|
2015-05-14 01:01:51 +03:00
|
|
|
// ContainerPathStat is used to encode the header from
|
2015-07-23 12:40:54 +03:00
|
|
|
// GET "/containers/{name:.*}/archive"
|
|
|
|
// "Name" is the file or directory name.
|
2015-05-13 04:21:26 +03:00
|
|
|
type ContainerPathStat struct {
|
2015-07-25 00:12:55 +03: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-13 04:21:26 +03:00
|
|
|
}
|
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// ContainerProcessList contains response of Remote API:
|
2015-04-10 01:13:01 +03:00
|
|
|
// GET "/containers/{name:.*}/top"
|
|
|
|
type ContainerProcessList struct {
|
|
|
|
Processes [][]string
|
|
|
|
Titles []string
|
|
|
|
}
|
2015-04-16 22:48:04 +03:00
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// Version contains response of Remote API:
|
|
|
|
// GET "/version"
|
2015-04-16 22:48:04 +03:00
|
|
|
type Version struct {
|
|
|
|
Version string
|
2016-01-04 20:43:38 +03:00
|
|
|
APIVersion string `json:"ApiVersion"`
|
2015-04-16 22:48:04 +03:00
|
|
|
GitCommit string
|
|
|
|
GoVersion string
|
|
|
|
Os string
|
|
|
|
Arch string
|
|
|
|
KernelVersion string `json:",omitempty"`
|
2015-06-04 02:56:09 +03:00
|
|
|
Experimental bool `json:",omitempty"`
|
2015-06-19 20:03:13 +03:00
|
|
|
BuildTime string `json:",omitempty"`
|
2015-04-16 22:48:04 +03:00
|
|
|
}
|
2015-04-10 20:26:30 +03:00
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// Info contains response of Remote API:
|
2015-04-10 20:26:30 +03:00
|
|
|
// GET "/info"
|
|
|
|
type Info struct {
|
|
|
|
ID string
|
|
|
|
Containers int
|
2016-01-12 03:26:00 +03:00
|
|
|
ContainersRunning int
|
|
|
|
ContainersPaused int
|
|
|
|
ContainersStopped int
|
2015-04-10 20:26:30 +03:00
|
|
|
Images int
|
|
|
|
Driver string
|
|
|
|
DriverStatus [][2]string
|
2016-01-16 02:26:15 +03:00
|
|
|
SystemStatus [][2]string
|
2015-10-23 09:08:26 +03:00
|
|
|
Plugins PluginsInfo
|
2015-04-10 20:26:30 +03:00
|
|
|
MemoryLimit bool
|
|
|
|
SwapLimit bool
|
2016-03-02 17:08:59 +03:00
|
|
|
KernelMemory bool
|
2015-07-23 12:40:54 +03:00
|
|
|
CPUCfsPeriod bool `json:"CpuCfsPeriod"`
|
|
|
|
CPUCfsQuota bool `json:"CpuCfsQuota"`
|
2015-10-09 10:02:04 +03:00
|
|
|
CPUShares bool
|
|
|
|
CPUSet bool
|
2015-04-10 20:26:30 +03:00
|
|
|
IPv4Forwarding bool
|
2015-06-17 04:19:11 +03:00
|
|
|
BridgeNfIptables bool
|
2015-07-23 12:40:54 +03:00
|
|
|
BridgeNfIP6tables bool `json:"BridgeNfIp6tables"`
|
2015-04-10 20:26:30 +03:00
|
|
|
Debug bool
|
|
|
|
NFd int
|
2015-02-26 14:53:55 +03:00
|
|
|
OomKillDisable bool
|
2015-04-10 20:26:30 +03:00
|
|
|
NGoroutines int
|
|
|
|
SystemTime string
|
|
|
|
ExecutionDriver string
|
|
|
|
LoggingDriver string
|
2016-02-17 10:33:15 +03:00
|
|
|
CgroupDriver string
|
2015-04-10 20:26:30 +03:00
|
|
|
NEventsListener int
|
|
|
|
KernelVersion string
|
|
|
|
OperatingSystem string
|
2015-06-13 10:39:19 +03:00
|
|
|
OSType string
|
|
|
|
Architecture string
|
2015-04-10 20:26:30 +03:00
|
|
|
IndexServerAddress string
|
2015-09-08 02:29:33 +03:00
|
|
|
RegistryConfig *registry.ServiceConfig
|
2015-04-10 20:26:30 +03:00
|
|
|
NCPU int
|
|
|
|
MemTotal int64
|
|
|
|
DockerRootDir string
|
2015-07-23 12:40:54 +03:00
|
|
|
HTTPProxy string `json:"HttpProxy"`
|
|
|
|
HTTPSProxy string `json:"HttpsProxy"`
|
2015-04-10 20:26:30 +03:00
|
|
|
NoProxy string
|
|
|
|
Name string
|
|
|
|
Labels []string
|
2015-05-20 01:09:58 +03:00
|
|
|
ExperimentalBuild bool
|
2015-09-21 07:23:54 +03:00
|
|
|
ServerVersion string
|
2015-09-11 02:12:00 +03:00
|
|
|
ClusterStore string
|
2015-10-26 03:12:22 +03:00
|
|
|
ClusterAdvertise string
|
2016-03-18 16:57:39 +03:00
|
|
|
SecurityOptions []string
|
2016-06-01 18:06:44 +03:00
|
|
|
Runtimes map[string]Runtime
|
2016-06-30 23:52:16 +03:00
|
|
|
DefaultRuntime string
|
2016-06-07 21:46:47 +03:00
|
|
|
Swarm swarm.Info
|
2016-07-26 17:37:29 +03:00
|
|
|
// LiveRestoreEnabled determines whether containers should be kept
|
|
|
|
// running when the daemon is shutdown or upon daemon start if
|
|
|
|
// running containers are detected
|
|
|
|
LiveRestoreEnabled bool
|
2015-04-10 20:26:30 +03:00
|
|
|
}
|
2015-04-17 08:36:23 +03:00
|
|
|
|
2016-02-06 17:45:03 +03:00
|
|
|
// PluginsInfo is a temp struct holding Plugins name
|
|
|
|
// registered with docker daemon. It is used by Info struct
|
2015-10-23 09:08:26 +03:00
|
|
|
type PluginsInfo struct {
|
|
|
|
// List of Volume plugins registered
|
|
|
|
Volume []string
|
|
|
|
// List of Network plugins registered
|
|
|
|
Network []string
|
2015-12-30 00:10:23 +03:00
|
|
|
// List of Authorization plugins registered
|
|
|
|
Authorization []string
|
2015-10-23 09:08:26 +03:00
|
|
|
}
|
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// ExecStartCheck is a temp struct used by execStart
|
2015-04-17 08:36:23 +03: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 17:17:14 +03:00
|
|
|
|
2016-05-25 21:04:32 +03:00
|
|
|
// HealthcheckResult stores information about a single run of a healthcheck probe
|
|
|
|
type HealthcheckResult struct {
|
2016-05-27 02:00:40 +03:00
|
|
|
Start time.Time // Start is the time this check started
|
|
|
|
End time.Time // End is the time this check ended
|
2016-07-23 01:55:24 +03:00
|
|
|
ExitCode int // ExitCode meanings: 0=healthy, 1=unhealthy, 2=reserved (considered unhealthy), else=error running probe
|
2016-05-27 02:00:40 +03:00
|
|
|
Output string // Output from last check
|
2016-05-25 21:04:32 +03:00
|
|
|
}
|
|
|
|
|
2016-05-26 02:47:05 +03:00
|
|
|
// Health states
|
|
|
|
const (
|
2016-05-27 02:00:40 +03:00
|
|
|
Starting = "starting" // Starting indicates that the container is not yet ready
|
|
|
|
Healthy = "healthy" // Healthy indicates that the container is running correctly
|
|
|
|
Unhealthy = "unhealthy" // Unhealthy indicates that the container has a problem
|
2016-05-26 02:47:05 +03:00
|
|
|
)
|
|
|
|
|
2016-05-25 21:04:32 +03:00
|
|
|
// Health stores information about the container's healthcheck results
|
|
|
|
type Health struct {
|
2016-05-27 02:00:40 +03:00
|
|
|
Status string // Status is one of Starting, Healthy or Unhealthy
|
|
|
|
FailingStreak int // FailingStreak is the number of consecutive failures
|
|
|
|
Log []*HealthcheckResult // Log contains the last few results (oldest first)
|
2016-05-25 21:04:32 +03:00
|
|
|
}
|
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// ContainerState stores container's running state
|
|
|
|
// it's part of ContainerJSONBase and will return by "inspect" command
|
2015-04-13 17:17:14 +03:00
|
|
|
type ContainerState struct {
|
2015-07-28 03:48:27 +03:00
|
|
|
Status string
|
2015-04-13 17:17:14 +03:00
|
|
|
Running bool
|
|
|
|
Paused bool
|
|
|
|
Restarting bool
|
|
|
|
OOMKilled bool
|
|
|
|
Dead bool
|
|
|
|
Pid int
|
|
|
|
ExitCode int
|
|
|
|
Error string
|
2015-07-26 16:00:53 +03:00
|
|
|
StartedAt string
|
|
|
|
FinishedAt string
|
2016-05-25 21:04:32 +03:00
|
|
|
Health *Health `json:",omitempty"`
|
2015-04-13 17:17:14 +03:00
|
|
|
}
|
|
|
|
|
2016-04-02 00:44:30 +03:00
|
|
|
// ContainerNode stores information about the node that a container
|
2016-03-16 09:19:20 +03:00
|
|
|
// is running on. It's only available in Docker Swarm
|
|
|
|
type ContainerNode struct {
|
|
|
|
ID string
|
|
|
|
IPAddress string `json:"IP"`
|
|
|
|
Addr string
|
|
|
|
Name string
|
|
|
|
Cpus int
|
2016-06-07 06:48:08 +03:00
|
|
|
Memory int64
|
2016-03-16 09:19:20 +03:00
|
|
|
Labels map[string]string
|
|
|
|
}
|
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// ContainerJSONBase contains response of Remote API:
|
2016-06-07 22:04:50 +03:00
|
|
|
// GET "/containers/{name:.*}/json"
|
2015-06-03 00:37:59 +03:00
|
|
|
type ContainerJSONBase struct {
|
2015-07-23 12:40:54 +03:00
|
|
|
ID string `json:"Id"`
|
2015-07-26 16:00:53 +03:00
|
|
|
Created string
|
2015-04-13 17:17:14 +03:00
|
|
|
Path string
|
|
|
|
Args []string
|
|
|
|
State *ContainerState
|
|
|
|
Image string
|
|
|
|
ResolvConfPath string
|
|
|
|
HostnamePath string
|
|
|
|
HostsPath string
|
|
|
|
LogPath string
|
2016-03-16 09:19:20 +03:00
|
|
|
Node *ContainerNode `json:",omitempty"`
|
2015-04-13 17:17:14 +03:00
|
|
|
Name string
|
|
|
|
RestartCount int
|
|
|
|
Driver string
|
|
|
|
MountLabel string
|
|
|
|
ProcessLabel string
|
|
|
|
AppArmorProfile string
|
|
|
|
ExecIDs []string
|
2015-12-18 21:36:17 +03:00
|
|
|
HostConfig *container.HostConfig
|
2015-06-15 21:05:10 +03:00
|
|
|
GraphDriver GraphDriverData
|
2015-09-25 15:49:02 +03:00
|
|
|
SizeRw *int64 `json:",omitempty"`
|
|
|
|
SizeRootFs *int64 `json:",omitempty"`
|
2015-04-13 17:17:14 +03:00
|
|
|
}
|
2015-06-03 00:37:59 +03:00
|
|
|
|
2015-07-23 12:40:54 +03:00
|
|
|
// ContainerJSON is newly used struct along with MountPoint
|
2015-06-03 00:37:59 +03:00
|
|
|
type ContainerJSON struct {
|
|
|
|
*ContainerJSONBase
|
2015-10-27 05:35:49 +03:00
|
|
|
Mounts []MountPoint
|
2015-12-18 21:36:17 +03:00
|
|
|
Config *container.Config
|
2015-10-27 05:35:49 +03:00
|
|
|
NetworkSettings *NetworkSettings
|
|
|
|
}
|
|
|
|
|
|
|
|
// NetworkSettings exposes the network settings in the api
|
|
|
|
type NetworkSettings struct {
|
|
|
|
NetworkSettingsBase
|
2015-10-30 21:57:15 +03:00
|
|
|
DefaultNetworkSettings
|
2015-10-27 05:35:49 +03:00
|
|
|
Networks map[string]*network.EndpointSettings
|
|
|
|
}
|
|
|
|
|
Add containers’ networks to /containers/json
After addition of multi-host networking in Docker 1.9, Docker Remote
API is still returning only the network specified during creation
of the container in the “List Containers” (`/containers/json`) endpoint:
...
"HostConfig": {
"NetworkMode": "default"
},
The list of networks containers are attached to is only available at
Get Container (`/containers/<id>/json`) endpoint.
This does not allow applications utilizing multi-host networking to
be built on top of Docker Remote API.
Therefore I added a simple `"NetworkSettings"` section to the
`/containers/json` endpoint. This is not identical to the NetworkSettings
returned in Get Container (`/containers/<id>/json`) endpoint. It only
contains a single field `"Networks"`, which is essentially the same
value shown in inspect output of a container.
This change adds the following section to the `/containers/json`:
"NetworkSettings": {
"Networks": {
"bridge": {
"EndpointID": "2cdc4edb1ded3631c81f57966563e...",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02"
}
}
}
This is of type `SummaryNetworkSettings` type, a minimal version of
`api/types#NetworkSettings`.
Actually all I need is the network name and the IPAddress fields. If folks
find this addition too big, I can create a `SummaryEndpointSettings` field
as well, containing just the IPAddress field.
Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-12-10 07:48:50 +03:00
|
|
|
// SummaryNetworkSettings provides a summary of container's networks
|
2016-06-07 22:04:50 +03:00
|
|
|
// in /containers/json
|
Add containers’ networks to /containers/json
After addition of multi-host networking in Docker 1.9, Docker Remote
API is still returning only the network specified during creation
of the container in the “List Containers” (`/containers/json`) endpoint:
...
"HostConfig": {
"NetworkMode": "default"
},
The list of networks containers are attached to is only available at
Get Container (`/containers/<id>/json`) endpoint.
This does not allow applications utilizing multi-host networking to
be built on top of Docker Remote API.
Therefore I added a simple `"NetworkSettings"` section to the
`/containers/json` endpoint. This is not identical to the NetworkSettings
returned in Get Container (`/containers/<id>/json`) endpoint. It only
contains a single field `"Networks"`, which is essentially the same
value shown in inspect output of a container.
This change adds the following section to the `/containers/json`:
"NetworkSettings": {
"Networks": {
"bridge": {
"EndpointID": "2cdc4edb1ded3631c81f57966563e...",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02"
}
}
}
This is of type `SummaryNetworkSettings` type, a minimal version of
`api/types#NetworkSettings`.
Actually all I need is the network name and the IPAddress fields. If folks
find this addition too big, I can create a `SummaryEndpointSettings` field
as well, containing just the IPAddress field.
Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-12-10 07:48:50 +03:00
|
|
|
type SummaryNetworkSettings struct {
|
|
|
|
Networks map[string]*network.EndpointSettings
|
|
|
|
}
|
|
|
|
|
2015-10-27 05:35:49 +03:00
|
|
|
// NetworkSettingsBase holds basic information about networks
|
|
|
|
type NetworkSettingsBase struct {
|
2016-05-20 11:40:35 +03:00
|
|
|
Bridge string // Bridge is the Bridge name the network uses(e.g. `docker0`)
|
|
|
|
SandboxID string // SandboxID uniquely represents a container's network stack
|
|
|
|
HairpinMode bool // HairpinMode specifies if hairpin NAT should be enabled on the virtual interface
|
|
|
|
LinkLocalIPv6Address string // LinkLocalIPv6Address is an IPv6 unicast address using the link-local prefix
|
|
|
|
LinkLocalIPv6PrefixLen int // LinkLocalIPv6PrefixLen is the prefix length of an IPv6 unicast address
|
|
|
|
Ports nat.PortMap // Ports is a collection of PortBinding indexed by Port
|
|
|
|
SandboxKey string // SandboxKey identifies the sandbox
|
2015-10-27 05:35:49 +03:00
|
|
|
SecondaryIPAddresses []network.Address
|
|
|
|
SecondaryIPv6Addresses []network.Address
|
2015-06-03 00:37:59 +03:00
|
|
|
}
|
|
|
|
|
2015-10-30 21:57:15 +03:00
|
|
|
// DefaultNetworkSettings holds network information
|
|
|
|
// during the 2 release deprecation period.
|
|
|
|
// It will be removed in Docker 1.11.
|
|
|
|
type DefaultNetworkSettings struct {
|
2016-05-20 11:40:35 +03:00
|
|
|
EndpointID string // EndpointID uniquely represents a service endpoint in a Sandbox
|
|
|
|
Gateway string // Gateway holds the gateway address for the network
|
|
|
|
GlobalIPv6Address string // GlobalIPv6Address holds network's global IPv6 address
|
|
|
|
GlobalIPv6PrefixLen int // GlobalIPv6PrefixLen represents mask length of network's global IPv6 address
|
|
|
|
IPAddress string // IPAddress holds the IPv4 address for the network
|
|
|
|
IPPrefixLen int // IPPrefixLen represents mask length of network's IPv4 address
|
|
|
|
IPv6Gateway string // IPv6Gateway holds gateway address specific for IPv6
|
|
|
|
MacAddress string // MacAddress holds the MAC address for the network
|
2015-10-30 21:57:15 +03:00
|
|
|
}
|
|
|
|
|
2015-06-03 22:21:38 +03:00
|
|
|
// MountPoint represents a mount point configuration inside the container.
|
2016-07-01 18:30:13 +03:00
|
|
|
// This is used for reporting the mountpoints in use by a container.
|
2015-06-03 22:21:38 +03:00
|
|
|
type MountPoint struct {
|
2016-07-01 18:30:13 +03:00
|
|
|
Type mount.Type `json:",omitempty"`
|
|
|
|
Name string `json:",omitempty"`
|
2015-06-03 22:21:38 +03:00
|
|
|
Source string
|
|
|
|
Destination string
|
|
|
|
Driver string `json:",omitempty"`
|
2015-07-22 16:24:35 +03:00
|
|
|
Mode string
|
2015-06-03 22:21:38 +03:00
|
|
|
RW bool
|
2016-07-01 18:30:13 +03:00
|
|
|
Propagation mount.Propagation
|
2015-06-03 22:21:38 +03:00
|
|
|
}
|
2015-06-12 16:25:32 +03:00
|
|
|
|
|
|
|
// Volume represents the configuration of a volume for the remote API
|
|
|
|
type Volume struct {
|
2016-03-10 18:20:29 +03:00
|
|
|
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
|
|
|
|
Status map[string]interface{} `json:",omitempty"` // Status provides low-level status information about the volume
|
2016-03-22 02:43:50 +03:00
|
|
|
Labels map[string]string // Labels is metadata specific to the volume
|
2016-04-29 16:28:51 +03:00
|
|
|
Scope string // Scope describes the level at which the volume exists (e.g. `global` for cluster-wide or `local` for machine level)
|
2015-06-12 16:25:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// VolumesListResponse contains the response for the remote API:
|
|
|
|
// GET "/volumes"
|
|
|
|
type VolumesListResponse struct {
|
2016-01-06 02:00:50 +03:00
|
|
|
Volumes []*Volume // Volumes is the list of volumes being returned
|
|
|
|
Warnings []string // Warnings is a list of warnings that occurred when getting the list from the volume drivers
|
2015-06-12 16:25:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// VolumeCreateRequest contains the response for the remote API:
|
2015-10-17 14:49:14 +03:00
|
|
|
// POST "/volumes/create"
|
2015-06-12 16:25:32 +03: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.
|
2016-03-22 02:43:50 +03:00
|
|
|
Labels map[string]string // Labels holds metadata specific to the volume being created.
|
2015-06-12 16:25:32 +03:00
|
|
|
}
|
2015-09-25 13:19:17 +03:00
|
|
|
|
|
|
|
// NetworkResource is the body of the "get network" http response message
|
|
|
|
type NetworkResource struct {
|
2016-05-26 03:50:50 +03:00
|
|
|
Name string // Name is the requested name of the network
|
2016-06-30 18:23:57 +03:00
|
|
|
ID string `json:"Id"` // ID uniquely identifies a network on a single machine
|
2016-05-20 11:40:35 +03:00
|
|
|
Scope string // Scope describes the level at which the network exists (e.g. `global` for cluster-wide or `local` for machine level)
|
2016-05-26 03:50:50 +03:00
|
|
|
Driver string // Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`)
|
2016-05-20 11:40:35 +03:00
|
|
|
EnableIPv6 bool // EnableIPv6 represents whether to enable IPv6
|
|
|
|
IPAM network.IPAM // IPAM is the network's IP Address Management
|
2016-06-30 18:23:57 +03:00
|
|
|
Internal bool // Internal represents if the network is used internal only
|
2016-05-20 11:40:35 +03:00
|
|
|
Containers map[string]EndpointResource // Containers contains endpoints belonging to the network
|
|
|
|
Options map[string]string // Options holds the network specific options to use for when creating the network
|
|
|
|
Labels map[string]string // Labels holds metadata specific to the network being created
|
2015-09-25 13:19:17 +03:00
|
|
|
}
|
|
|
|
|
2015-11-05 09:17:37 +03:00
|
|
|
// EndpointResource contains network resources allocated and used for a container in a network
|
2015-09-25 13:19:17 +03:00
|
|
|
type EndpointResource struct {
|
2015-11-02 19:29:58 +03:00
|
|
|
Name string
|
2015-10-30 20:54:16 +03:00
|
|
|
EndpointID string
|
|
|
|
MacAddress string
|
|
|
|
IPv4Address string
|
|
|
|
IPv6Address string
|
2015-09-25 13:19:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// NetworkCreate is the expected body of the "create network" http request message
|
|
|
|
type NetworkCreate struct {
|
2015-10-30 20:54:16 +03:00
|
|
|
CheckDuplicate bool
|
|
|
|
Driver string
|
2016-01-29 21:16:23 +03:00
|
|
|
EnableIPv6 bool
|
2015-10-30 20:54:16 +03:00
|
|
|
IPAM network.IPAM
|
2016-01-12 00:25:29 +03:00
|
|
|
Internal bool
|
2015-10-30 20:54:16 +03:00
|
|
|
Options map[string]string
|
2016-03-14 17:42:14 +03:00
|
|
|
Labels map[string]string
|
2015-09-25 13:19:17 +03:00
|
|
|
}
|
|
|
|
|
2016-03-25 20:13:25 +03:00
|
|
|
// NetworkCreateRequest is the request message sent to the server for network create call.
|
|
|
|
type NetworkCreateRequest struct {
|
|
|
|
NetworkCreate
|
|
|
|
Name string
|
|
|
|
}
|
|
|
|
|
2015-09-25 13:19:17 +03:00
|
|
|
// NetworkCreateResponse is the response message sent by the server for network create call
|
|
|
|
type NetworkCreateResponse struct {
|
2015-10-30 20:54:16 +03:00
|
|
|
ID string `json:"Id"`
|
|
|
|
Warning string
|
2015-09-25 13:19:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// NetworkConnect represents the data to be used to connect a container to the network
|
|
|
|
type NetworkConnect struct {
|
2016-01-07 22:55:51 +03:00
|
|
|
Container string
|
2016-01-12 02:32:17 +03:00
|
|
|
EndpointConfig *network.EndpointSettings `json:",omitempty"`
|
2015-09-25 13:19:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// NetworkDisconnect represents the data to be used to disconnect a container from the network
|
|
|
|
type NetworkDisconnect struct {
|
2015-10-30 20:54:16 +03:00
|
|
|
Container string
|
2016-01-10 01:54:49 +03:00
|
|
|
Force bool
|
2015-09-25 13:19:17 +03:00
|
|
|
}
|
2016-04-14 16:13:42 +03:00
|
|
|
|
|
|
|
// Checkpoint represents the details of a checkpoint
|
|
|
|
type Checkpoint struct {
|
|
|
|
Name string // Name is the name of the checkpoint
|
|
|
|
}
|
2016-06-01 18:06:44 +03:00
|
|
|
|
|
|
|
// Runtime describes an OCI runtime
|
|
|
|
type Runtime struct {
|
|
|
|
Path string `json:"path"`
|
|
|
|
Args []string `json:"runtimeArgs,omitempty"`
|
|
|
|
}
|