2015-02-24 11:12:47 -08:00
|
|
|
package types
|
|
|
|
|
2015-04-13 16:17:14 +02:00
|
|
|
import (
|
2015-05-12 18:21:26 -07:00
|
|
|
"os"
|
2015-04-13 16:17:14 +02:00
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/docker/docker/daemon/network"
|
|
|
|
"github.com/docker/docker/pkg/version"
|
|
|
|
"github.com/docker/docker/runconfig"
|
|
|
|
)
|
2015-04-16 21:48:04 +02:00
|
|
|
|
2015-02-24 11:12:47 -08: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 22:03:54 +01:00
|
|
|
|
|
|
|
// POST /containers/{name:.*}/exec
|
|
|
|
type ContainerExecCreateResponse struct {
|
|
|
|
// ID is the exec ID.
|
|
|
|
ID string `json:"Id"`
|
|
|
|
}
|
2015-03-23 23:32:50 +01:00
|
|
|
|
|
|
|
// POST /auth
|
|
|
|
type AuthResponse struct {
|
|
|
|
// Status is the authentication status
|
|
|
|
Status string `json:"Status"`
|
|
|
|
}
|
2015-03-25 21:01:14 -06:00
|
|
|
|
2015-03-25 22:22:45 -06:00
|
|
|
// POST "/containers/"+containerID+"/wait"
|
2015-03-25 21:01:14 -06:00
|
|
|
type ContainerWaitResponse struct {
|
|
|
|
// StatusCode is the status code of the wait job
|
|
|
|
StatusCode int `json:"StatusCode"`
|
|
|
|
}
|
2015-03-28 17:39:24 +01:00
|
|
|
|
|
|
|
// POST "/commit?container="+containerID
|
|
|
|
type ContainerCommitResponse struct {
|
|
|
|
ID string `json:"Id"`
|
|
|
|
}
|
2015-04-02 15:52:34 -07:00
|
|
|
|
|
|
|
// GET "/containers/{name:.*}/changes"
|
|
|
|
type ContainerChange struct {
|
|
|
|
Kind int
|
|
|
|
Path string
|
|
|
|
}
|
2015-04-03 08:31:30 -07:00
|
|
|
|
|
|
|
// GET "/images/{name:.*}/history"
|
|
|
|
type ImageHistory struct {
|
|
|
|
ID string `json:"Id"`
|
2015-05-14 17:31:34 -07:00
|
|
|
Created int64
|
2015-04-03 08:31:30 -07:00
|
|
|
CreatedBy string
|
|
|
|
Tags []string
|
|
|
|
Size int64
|
2015-01-04 14:47:01 +08:00
|
|
|
Comment string
|
2015-04-03 08:31:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// DELETE "/images/{name:.*}"
|
|
|
|
type ImageDelete struct {
|
|
|
|
Untagged string `json:",omitempty"`
|
|
|
|
Deleted string `json:",omitempty"`
|
|
|
|
}
|
2015-04-03 17:39:06 -07:00
|
|
|
|
|
|
|
// GET "/images/json"
|
|
|
|
type Image struct {
|
|
|
|
ID string `json:"Id"`
|
|
|
|
ParentId string
|
|
|
|
RepoTags []string
|
|
|
|
RepoDigests []string
|
2015-05-14 17:31:34 -07:00
|
|
|
Created int
|
2015-04-03 17:39:06 -07:00
|
|
|
Size int
|
|
|
|
VirtualSize int
|
|
|
|
Labels map[string]string
|
|
|
|
}
|
|
|
|
|
2015-06-15 14:05:10 -04:00
|
|
|
type GraphDriverData struct {
|
|
|
|
Name string
|
|
|
|
Data map[string]string
|
|
|
|
}
|
|
|
|
|
2015-03-26 19:43:00 +00:00
|
|
|
// GET "/images/{name:.*}/json"
|
|
|
|
type ImageInspect struct {
|
|
|
|
Id string
|
|
|
|
Parent string
|
|
|
|
Comment string
|
2015-07-26 15:00:53 +02:00
|
|
|
Created string
|
2015-03-26 19:43:00 +00: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 19:43:00 +00:00
|
|
|
}
|
|
|
|
|
2015-04-03 17:39:06 -07:00
|
|
|
// GET "/containers/json"
|
|
|
|
type Port struct {
|
2015-06-12 09:49:53 -07:00
|
|
|
IP string `json:",omitempty"`
|
2015-04-03 17:39:06 -07:00
|
|
|
PrivatePort int
|
2015-06-12 09:49:53 -07:00
|
|
|
PublicPort int `json:",omitempty"`
|
2015-04-03 17:39:06 -07:00
|
|
|
Type string
|
|
|
|
}
|
|
|
|
|
|
|
|
type Container struct {
|
2015-06-03 18:23:14 +02:00
|
|
|
ID string `json:"Id"`
|
|
|
|
Names []string
|
|
|
|
Image string
|
|
|
|
Command string
|
|
|
|
Created int
|
|
|
|
Ports []Port
|
2015-06-03 23:13:56 +02:00
|
|
|
SizeRw int `json:",omitempty"`
|
|
|
|
SizeRootFs int `json:",omitempty"`
|
2015-06-03 18:23:14 +02:00
|
|
|
Labels map[string]string
|
|
|
|
Status string
|
2015-06-22 11:44:33 +05:30
|
|
|
HostConfig struct {
|
|
|
|
NetworkMode string `json:",omitempty"`
|
|
|
|
}
|
2015-04-03 17:39:06 -07:00
|
|
|
}
|
2015-04-09 13:05:31 -07:00
|
|
|
|
|
|
|
// POST "/containers/"+containerID+"/copy"
|
|
|
|
type CopyConfig struct {
|
|
|
|
Resource string
|
|
|
|
}
|
2015-04-09 15:13:01 -07:00
|
|
|
|
2015-05-13 15:01:51 -07:00
|
|
|
// ContainerPathStat is used to encode the header from
|
|
|
|
// GET /containers/{name:.*}/archive
|
|
|
|
// "name" is the file or directory name.
|
|
|
|
// "path" is the absolute path to the resource in the container.
|
2015-05-12 18:21:26 -07:00
|
|
|
type ContainerPathStat struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
Path string `json:"path"`
|
|
|
|
Size int64 `json:"size"`
|
|
|
|
Mode os.FileMode `json:"mode"`
|
|
|
|
Mtime time.Time `json:"mtime"`
|
|
|
|
}
|
|
|
|
|
2015-04-09 15:13:01 -07:00
|
|
|
// GET "/containers/{name:.*}/top"
|
|
|
|
type ContainerProcessList struct {
|
|
|
|
Processes [][]string
|
|
|
|
Titles []string
|
|
|
|
}
|
2015-04-16 21:48:04 +02:00
|
|
|
|
|
|
|
type Version struct {
|
|
|
|
Version string
|
|
|
|
ApiVersion version.Version
|
|
|
|
GitCommit string
|
|
|
|
GoVersion string
|
|
|
|
Os string
|
|
|
|
Arch string
|
|
|
|
KernelVersion string `json:",omitempty"`
|
2015-06-03 16:56:09 -07:00
|
|
|
Experimental bool `json:",omitempty"`
|
2015-06-19 10:03:13 -07:00
|
|
|
BuildTime string `json:",omitempty"`
|
2015-04-16 21:48:04 +02:00
|
|
|
}
|
2015-04-11 01:26:30 +08:00
|
|
|
|
|
|
|
// GET "/info"
|
|
|
|
type Info struct {
|
|
|
|
ID string
|
|
|
|
Containers int
|
|
|
|
Images int
|
|
|
|
Driver string
|
|
|
|
DriverStatus [][2]string
|
|
|
|
MemoryLimit bool
|
|
|
|
SwapLimit bool
|
2015-04-08 16:58:59 +08:00
|
|
|
CpuCfsPeriod bool
|
2015-04-20 08:16:47 -07:00
|
|
|
CpuCfsQuota bool
|
2015-04-11 01:26:30 +08:00
|
|
|
IPv4Forwarding bool
|
2015-06-17 09:19:11 +08:00
|
|
|
BridgeNfIptables bool
|
|
|
|
BridgeNfIp6tables bool
|
2015-04-11 01:26:30 +08:00
|
|
|
Debug bool
|
|
|
|
NFd int
|
2015-02-26 19:53:55 +08:00
|
|
|
OomKillDisable bool
|
2015-04-11 01:26:30 +08:00
|
|
|
NGoroutines int
|
|
|
|
SystemTime string
|
|
|
|
ExecutionDriver string
|
|
|
|
LoggingDriver string
|
|
|
|
NEventsListener int
|
|
|
|
KernelVersion string
|
|
|
|
OperatingSystem string
|
|
|
|
IndexServerAddress string
|
|
|
|
RegistryConfig interface{}
|
|
|
|
InitSha1 string
|
|
|
|
InitPath string
|
|
|
|
NCPU int
|
|
|
|
MemTotal int64
|
|
|
|
DockerRootDir string
|
|
|
|
HttpProxy string
|
|
|
|
HttpsProxy string
|
|
|
|
NoProxy string
|
|
|
|
Name string
|
|
|
|
Labels []string
|
2015-05-19 15:09:58 -07:00
|
|
|
ExperimentalBuild bool
|
2015-04-11 01:26:30 +08:00
|
|
|
}
|
2015-04-17 13:36:23 +08:00
|
|
|
|
|
|
|
// This struct is a temp struct used by execStart
|
|
|
|
// 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 16:17:14 +02:00
|
|
|
|
|
|
|
type ContainerState struct {
|
|
|
|
Running bool
|
|
|
|
Paused bool
|
|
|
|
Restarting bool
|
|
|
|
OOMKilled bool
|
|
|
|
Dead bool
|
|
|
|
Pid int
|
|
|
|
ExitCode int
|
|
|
|
Error string
|
2015-07-26 15:00:53 +02:00
|
|
|
StartedAt string
|
|
|
|
FinishedAt string
|
2015-04-13 16:17:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// GET "/containers/{name:.*}/json"
|
2015-06-02 23:37:59 +02:00
|
|
|
type ContainerJSONBase struct {
|
2015-04-13 16:17:14 +02:00
|
|
|
Id string
|
2015-07-26 15:00:53 +02:00
|
|
|
Created string
|
2015-04-13 16:17:14 +02:00
|
|
|
Path string
|
|
|
|
Args []string
|
|
|
|
State *ContainerState
|
|
|
|
Image string
|
|
|
|
NetworkSettings *network.Settings
|
|
|
|
ResolvConfPath string
|
|
|
|
HostnamePath string
|
|
|
|
HostsPath string
|
|
|
|
LogPath string
|
|
|
|
Name string
|
|
|
|
RestartCount int
|
|
|
|
Driver string
|
|
|
|
ExecDriver string
|
|
|
|
MountLabel string
|
|
|
|
ProcessLabel string
|
|
|
|
AppArmorProfile string
|
|
|
|
ExecIDs []string
|
|
|
|
HostConfig *runconfig.HostConfig
|
2015-06-15 14:05:10 -04:00
|
|
|
GraphDriver GraphDriverData
|
2015-04-13 16:17:14 +02:00
|
|
|
}
|
2015-06-02 23:37:59 +02:00
|
|
|
|
|
|
|
type ContainerJSON struct {
|
|
|
|
*ContainerJSONBase
|
2015-06-03 12:21:38 -07:00
|
|
|
Mounts []MountPoint
|
2015-06-02 23:37:59 +02:00
|
|
|
Config *runconfig.Config
|
|
|
|
}
|
|
|
|
|
2015-07-16 14:14:58 -07:00
|
|
|
// backcompatibility struct along with ContainerConfig. Note this is not
|
|
|
|
// used by the Windows daemon.
|
2015-06-03 12:21:38 -07:00
|
|
|
type ContainerJSONPre120 struct {
|
2015-06-02 23:37:59 +02:00
|
|
|
*ContainerJSONBase
|
2015-06-03 12:21:38 -07:00
|
|
|
Volumes map[string]string
|
|
|
|
VolumesRW map[string]bool
|
|
|
|
Config *ContainerConfig
|
2015-06-02 23:37:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type ContainerConfig struct {
|
|
|
|
*runconfig.Config
|
|
|
|
|
|
|
|
// backward compatibility, they now live in HostConfig
|
|
|
|
Memory int64
|
|
|
|
MemorySwap int64
|
|
|
|
CpuShares int64
|
|
|
|
Cpuset string
|
|
|
|
}
|
2015-06-03 12:21:38 -07: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 12:21:38 -07:00
|
|
|
RW bool
|
|
|
|
}
|