types.go 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  1. package types // import "github.com/docker/docker/api/types"
  2. import (
  3. "errors"
  4. "fmt"
  5. "io"
  6. "os"
  7. "strings"
  8. "time"
  9. "github.com/docker/docker/api/types/container"
  10. "github.com/docker/docker/api/types/filters"
  11. "github.com/docker/docker/api/types/mount"
  12. "github.com/docker/docker/api/types/network"
  13. "github.com/docker/docker/api/types/registry"
  14. "github.com/docker/docker/api/types/swarm"
  15. "github.com/docker/docker/api/types/volume"
  16. "github.com/docker/go-connections/nat"
  17. )
  18. // RootFS returns Image's RootFS description including the layer IDs.
  19. type RootFS struct {
  20. Type string `json:",omitempty"`
  21. Layers []string `json:",omitempty"`
  22. }
  23. // ImageInspect contains response of Engine API:
  24. // GET "/images/{name:.*}/json"
  25. type ImageInspect struct {
  26. // ID is the content-addressable ID of an image.
  27. //
  28. // This identifier is a content-addressable digest calculated from the
  29. // image's configuration (which includes the digests of layers used by
  30. // the image).
  31. //
  32. // Note that this digest differs from the `RepoDigests` below, which
  33. // holds digests of image manifests that reference the image.
  34. ID string `json:"Id"`
  35. // RepoTags is a list of image names/tags in the local image cache that
  36. // reference this image.
  37. //
  38. // Multiple image tags can refer to the same imagem and this list may be
  39. // empty if no tags reference the image, in which case the image is
  40. // "untagged", in which case it can still be referenced by its ID.
  41. RepoTags []string
  42. // RepoDigests is a list of content-addressable digests of locally available
  43. // image manifests that the image is referenced from. Multiple manifests can
  44. // refer to the same image.
  45. //
  46. // These digests are usually only available if the image was either pulled
  47. // from a registry, or if the image was pushed to a registry, which is when
  48. // the manifest is generated and its digest calculated.
  49. RepoDigests []string
  50. // Parent is the ID of the parent image.
  51. //
  52. // Depending on how the image was created, this field may be empty and
  53. // is only set for images that were built/created locally. This field
  54. // is empty if the image was pulled from an image registry.
  55. Parent string
  56. // Comment is an optional message that can be set when committing or
  57. // importing the image.
  58. Comment string
  59. // Created is the date and time at which the image was created, formatted in
  60. // RFC 3339 nano-seconds (time.RFC3339Nano).
  61. Created string
  62. // Container is the ID of the container that was used to create the image.
  63. //
  64. // Depending on how the image was created, this field may be empty.
  65. Container string
  66. // ContainerConfig is an optional field containing the configuration of the
  67. // container that was last committed when creating the image.
  68. //
  69. // Previous versions of Docker builder used this field to store build cache,
  70. // and it is not in active use anymore.
  71. ContainerConfig *container.Config
  72. // DockerVersion is the version of Docker that was used to build the image.
  73. //
  74. // Depending on how the image was created, this field may be empty.
  75. DockerVersion string
  76. // Author is the name of the author that was specified when committing the
  77. // image, or as specified through MAINTAINER (deprecated) in the Dockerfile.
  78. Author string
  79. Config *container.Config
  80. // Architecture is the hardware CPU architecture that the image runs on.
  81. Architecture string
  82. // Variant is the CPU architecture variant (presently ARM-only).
  83. Variant string `json:",omitempty"`
  84. // OS is the Operating System the image is built to run on.
  85. Os string
  86. // OsVersion is the version of the Operating System the image is built to
  87. // run on (especially for Windows).
  88. OsVersion string `json:",omitempty"`
  89. // Size is the total size of the image including all layers it is composed of.
  90. Size int64
  91. // VirtualSize is the total size of the image including all layers it is
  92. // composed of.
  93. //
  94. // In versions of Docker before v1.10, this field was calculated from
  95. // the image itself and all of its parent images. Docker v1.10 and up
  96. // store images self-contained, and no longer use a parent-chain, making
  97. // this field an equivalent of the Size field.
  98. //
  99. // This field is kept for backward compatibility, but may be removed in
  100. // a future version of the API.
  101. VirtualSize int64 // TODO(thaJeztah): deprecate this field
  102. // GraphDriver holds information about the storage driver used to store the
  103. // container's and image's filesystem.
  104. GraphDriver GraphDriverData
  105. // RootFS contains information about the image's RootFS, including the
  106. // layer IDs.
  107. RootFS RootFS
  108. // Metadata of the image in the local cache.
  109. //
  110. // This information is local to the daemon, and not part of the image itself.
  111. Metadata ImageMetadata
  112. }
  113. // ImageMetadata contains engine-local data about the image
  114. type ImageMetadata struct {
  115. // LastTagTime is the date and time at which the image was last tagged.
  116. LastTagTime time.Time `json:",omitempty"`
  117. }
  118. // Container contains response of Engine API:
  119. // GET "/containers/json"
  120. type Container struct {
  121. ID string `json:"Id"`
  122. Names []string
  123. Image string
  124. ImageID string
  125. Command string
  126. Created int64
  127. Ports []Port
  128. SizeRw int64 `json:",omitempty"`
  129. SizeRootFs int64 `json:",omitempty"`
  130. Labels map[string]string
  131. State string
  132. Status string
  133. HostConfig struct {
  134. NetworkMode string `json:",omitempty"`
  135. }
  136. NetworkSettings *SummaryNetworkSettings
  137. Mounts []MountPoint
  138. }
  139. // CopyConfig contains request body of Engine API:
  140. // POST "/containers/"+containerID+"/copy"
  141. type CopyConfig struct {
  142. Resource string
  143. }
  144. // ContainerPathStat is used to encode the header from
  145. // GET "/containers/{name:.*}/archive"
  146. // "Name" is the file or directory name.
  147. type ContainerPathStat struct {
  148. Name string `json:"name"`
  149. Size int64 `json:"size"`
  150. Mode os.FileMode `json:"mode"`
  151. Mtime time.Time `json:"mtime"`
  152. LinkTarget string `json:"linkTarget"`
  153. }
  154. // ContainerStats contains response of Engine API:
  155. // GET "/stats"
  156. type ContainerStats struct {
  157. Body io.ReadCloser `json:"body"`
  158. OSType string `json:"ostype"`
  159. }
  160. // Ping contains response of Engine API:
  161. // GET "/_ping"
  162. type Ping struct {
  163. APIVersion string
  164. OSType string
  165. Experimental bool
  166. BuilderVersion BuilderVersion
  167. // SwarmStatus provides information about the current swarm status of the
  168. // engine, obtained from the "Swarm" header in the API response.
  169. //
  170. // It can be a nil struct if the API version does not provide this header
  171. // in the ping response, or if an error occurred, in which case the client
  172. // should use other ways to get the current swarm status, such as the /swarm
  173. // endpoint.
  174. SwarmStatus *swarm.Status
  175. }
  176. // ComponentVersion describes the version information for a specific component.
  177. type ComponentVersion struct {
  178. Name string
  179. Version string
  180. Details map[string]string `json:",omitempty"`
  181. }
  182. // Version contains response of Engine API:
  183. // GET "/version"
  184. type Version struct {
  185. Platform struct{ Name string } `json:",omitempty"`
  186. Components []ComponentVersion `json:",omitempty"`
  187. // The following fields are deprecated, they relate to the Engine component and are kept for backwards compatibility
  188. Version string
  189. APIVersion string `json:"ApiVersion"`
  190. MinAPIVersion string `json:"MinAPIVersion,omitempty"`
  191. GitCommit string
  192. GoVersion string
  193. Os string
  194. Arch string
  195. KernelVersion string `json:",omitempty"`
  196. Experimental bool `json:",omitempty"`
  197. BuildTime string `json:",omitempty"`
  198. }
  199. // Commit holds the Git-commit (SHA1) that a binary was built from, as reported
  200. // in the version-string of external tools, such as containerd, or runC.
  201. type Commit struct {
  202. ID string // ID is the actual commit ID of external tool.
  203. Expected string // Expected is the commit ID of external tool expected by dockerd as set at build time.
  204. }
  205. // Info contains response of Engine API:
  206. // GET "/info"
  207. type Info struct {
  208. ID string
  209. Containers int
  210. ContainersRunning int
  211. ContainersPaused int
  212. ContainersStopped int
  213. Images int
  214. Driver string
  215. DriverStatus [][2]string
  216. SystemStatus [][2]string `json:",omitempty"` // SystemStatus is only propagated by the Swarm standalone API
  217. Plugins PluginsInfo
  218. MemoryLimit bool
  219. SwapLimit bool
  220. KernelMemory bool `json:",omitempty"` // Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes
  221. KernelMemoryTCP bool `json:",omitempty"` // KernelMemoryTCP is not supported on cgroups v2.
  222. CPUCfsPeriod bool `json:"CpuCfsPeriod"`
  223. CPUCfsQuota bool `json:"CpuCfsQuota"`
  224. CPUShares bool
  225. CPUSet bool
  226. PidsLimit bool
  227. IPv4Forwarding bool
  228. BridgeNfIptables bool
  229. BridgeNfIP6tables bool `json:"BridgeNfIp6tables"`
  230. Debug bool
  231. NFd int
  232. OomKillDisable bool
  233. NGoroutines int
  234. SystemTime string
  235. LoggingDriver string
  236. CgroupDriver string
  237. CgroupVersion string `json:",omitempty"`
  238. NEventsListener int
  239. KernelVersion string
  240. OperatingSystem string
  241. OSVersion string
  242. OSType string
  243. Architecture string
  244. IndexServerAddress string
  245. RegistryConfig *registry.ServiceConfig
  246. NCPU int
  247. MemTotal int64
  248. GenericResources []swarm.GenericResource
  249. DockerRootDir string
  250. HTTPProxy string `json:"HttpProxy"`
  251. HTTPSProxy string `json:"HttpsProxy"`
  252. NoProxy string
  253. Name string
  254. Labels []string
  255. ExperimentalBuild bool
  256. ServerVersion string
  257. ClusterStore string `json:",omitempty"` // Deprecated: host-discovery and overlay networks with external k/v stores are deprecated
  258. ClusterAdvertise string `json:",omitempty"` // Deprecated: host-discovery and overlay networks with external k/v stores are deprecated
  259. Runtimes map[string]Runtime
  260. DefaultRuntime string
  261. Swarm swarm.Info
  262. // LiveRestoreEnabled determines whether containers should be kept
  263. // running when the daemon is shutdown or upon daemon start if
  264. // running containers are detected
  265. LiveRestoreEnabled bool
  266. Isolation container.Isolation
  267. InitBinary string
  268. ContainerdCommit Commit
  269. RuncCommit Commit
  270. InitCommit Commit
  271. SecurityOptions []string
  272. ProductLicense string `json:",omitempty"`
  273. DefaultAddressPools []NetworkAddressPool `json:",omitempty"`
  274. // Warnings contains a slice of warnings that occurred while collecting
  275. // system information. These warnings are intended to be informational
  276. // messages for the user, and are not intended to be parsed / used for
  277. // other purposes, as they do not have a fixed format.
  278. Warnings []string
  279. }
  280. // KeyValue holds a key/value pair
  281. type KeyValue struct {
  282. Key, Value string
  283. }
  284. // NetworkAddressPool is a temp struct used by Info struct
  285. type NetworkAddressPool struct {
  286. Base string
  287. Size int
  288. }
  289. // SecurityOpt contains the name and options of a security option
  290. type SecurityOpt struct {
  291. Name string
  292. Options []KeyValue
  293. }
  294. // DecodeSecurityOptions decodes a security options string slice to a type safe
  295. // SecurityOpt
  296. func DecodeSecurityOptions(opts []string) ([]SecurityOpt, error) {
  297. so := []SecurityOpt{}
  298. for _, opt := range opts {
  299. // support output from a < 1.13 docker daemon
  300. if !strings.Contains(opt, "=") {
  301. so = append(so, SecurityOpt{Name: opt})
  302. continue
  303. }
  304. secopt := SecurityOpt{}
  305. split := strings.Split(opt, ",")
  306. for _, s := range split {
  307. kv := strings.SplitN(s, "=", 2)
  308. if len(kv) != 2 {
  309. return nil, fmt.Errorf("invalid security option %q", s)
  310. }
  311. if kv[0] == "" || kv[1] == "" {
  312. return nil, errors.New("invalid empty security option")
  313. }
  314. if kv[0] == "name" {
  315. secopt.Name = kv[1]
  316. continue
  317. }
  318. secopt.Options = append(secopt.Options, KeyValue{Key: kv[0], Value: kv[1]})
  319. }
  320. so = append(so, secopt)
  321. }
  322. return so, nil
  323. }
  324. // PluginsInfo is a temp struct holding Plugins name
  325. // registered with docker daemon. It is used by Info struct
  326. type PluginsInfo struct {
  327. // List of Volume plugins registered
  328. Volume []string
  329. // List of Network plugins registered
  330. Network []string
  331. // List of Authorization plugins registered
  332. Authorization []string
  333. // List of Log plugins registered
  334. Log []string
  335. }
  336. // ExecStartCheck is a temp struct used by execStart
  337. // Config fields is part of ExecConfig in runconfig package
  338. type ExecStartCheck struct {
  339. // ExecStart will first check if it's detached
  340. Detach bool
  341. // Check if there's a tty
  342. Tty bool
  343. }
  344. // HealthcheckResult stores information about a single run of a healthcheck probe
  345. type HealthcheckResult struct {
  346. Start time.Time // Start is the time this check started
  347. End time.Time // End is the time this check ended
  348. ExitCode int // ExitCode meanings: 0=healthy, 1=unhealthy, 2=reserved (considered unhealthy), else=error running probe
  349. Output string // Output from last check
  350. }
  351. // Health states
  352. const (
  353. NoHealthcheck = "none" // Indicates there is no healthcheck
  354. Starting = "starting" // Starting indicates that the container is not yet ready
  355. Healthy = "healthy" // Healthy indicates that the container is running correctly
  356. Unhealthy = "unhealthy" // Unhealthy indicates that the container has a problem
  357. )
  358. // Health stores information about the container's healthcheck results
  359. type Health struct {
  360. Status string // Status is one of Starting, Healthy or Unhealthy
  361. FailingStreak int // FailingStreak is the number of consecutive failures
  362. Log []*HealthcheckResult // Log contains the last few results (oldest first)
  363. }
  364. // ContainerState stores container's running state
  365. // it's part of ContainerJSONBase and will return by "inspect" command
  366. type ContainerState struct {
  367. Status string // String representation of the container state. Can be one of "created", "running", "paused", "restarting", "removing", "exited", or "dead"
  368. Running bool
  369. Paused bool
  370. Restarting bool
  371. OOMKilled bool
  372. Dead bool
  373. Pid int
  374. ExitCode int
  375. Error string
  376. StartedAt string
  377. FinishedAt string
  378. Health *Health `json:",omitempty"`
  379. }
  380. // ContainerNode stores information about the node that a container
  381. // is running on. It's only used by the Docker Swarm standalone API
  382. type ContainerNode struct {
  383. ID string
  384. IPAddress string `json:"IP"`
  385. Addr string
  386. Name string
  387. Cpus int
  388. Memory int64
  389. Labels map[string]string
  390. }
  391. // ContainerJSONBase contains response of Engine API:
  392. // GET "/containers/{name:.*}/json"
  393. type ContainerJSONBase struct {
  394. ID string `json:"Id"`
  395. Created string
  396. Path string
  397. Args []string
  398. State *ContainerState
  399. Image string
  400. ResolvConfPath string
  401. HostnamePath string
  402. HostsPath string
  403. LogPath string
  404. Node *ContainerNode `json:",omitempty"` // Node is only propagated by Docker Swarm standalone API
  405. Name string
  406. RestartCount int
  407. Driver string
  408. Platform string
  409. MountLabel string
  410. ProcessLabel string
  411. AppArmorProfile string
  412. ExecIDs []string
  413. HostConfig *container.HostConfig
  414. GraphDriver GraphDriverData
  415. SizeRw *int64 `json:",omitempty"`
  416. SizeRootFs *int64 `json:",omitempty"`
  417. }
  418. // ContainerJSON is newly used struct along with MountPoint
  419. type ContainerJSON struct {
  420. *ContainerJSONBase
  421. Mounts []MountPoint
  422. Config *container.Config
  423. NetworkSettings *NetworkSettings
  424. }
  425. // NetworkSettings exposes the network settings in the api
  426. type NetworkSettings struct {
  427. NetworkSettingsBase
  428. DefaultNetworkSettings
  429. Networks map[string]*network.EndpointSettings
  430. }
  431. // SummaryNetworkSettings provides a summary of container's networks
  432. // in /containers/json
  433. type SummaryNetworkSettings struct {
  434. Networks map[string]*network.EndpointSettings
  435. }
  436. // NetworkSettingsBase holds basic information about networks
  437. type NetworkSettingsBase struct {
  438. Bridge string // Bridge is the Bridge name the network uses(e.g. `docker0`)
  439. SandboxID string // SandboxID uniquely represents a container's network stack
  440. HairpinMode bool // HairpinMode specifies if hairpin NAT should be enabled on the virtual interface
  441. LinkLocalIPv6Address string // LinkLocalIPv6Address is an IPv6 unicast address using the link-local prefix
  442. LinkLocalIPv6PrefixLen int // LinkLocalIPv6PrefixLen is the prefix length of an IPv6 unicast address
  443. Ports nat.PortMap // Ports is a collection of PortBinding indexed by Port
  444. SandboxKey string // SandboxKey identifies the sandbox
  445. SecondaryIPAddresses []network.Address
  446. SecondaryIPv6Addresses []network.Address
  447. }
  448. // DefaultNetworkSettings holds network information
  449. // during the 2 release deprecation period.
  450. // It will be removed in Docker 1.11.
  451. type DefaultNetworkSettings struct {
  452. EndpointID string // EndpointID uniquely represents a service endpoint in a Sandbox
  453. Gateway string // Gateway holds the gateway address for the network
  454. GlobalIPv6Address string // GlobalIPv6Address holds network's global IPv6 address
  455. GlobalIPv6PrefixLen int // GlobalIPv6PrefixLen represents mask length of network's global IPv6 address
  456. IPAddress string // IPAddress holds the IPv4 address for the network
  457. IPPrefixLen int // IPPrefixLen represents mask length of network's IPv4 address
  458. IPv6Gateway string // IPv6Gateway holds gateway address specific for IPv6
  459. MacAddress string // MacAddress holds the MAC address for the network
  460. }
  461. // MountPoint represents a mount point configuration inside the container.
  462. // This is used for reporting the mountpoints in use by a container.
  463. type MountPoint struct {
  464. // Type is the type of mount, see `Type<foo>` definitions in
  465. // github.com/docker/docker/api/types/mount.Type
  466. Type mount.Type `json:",omitempty"`
  467. // Name is the name reference to the underlying data defined by `Source`
  468. // e.g., the volume name.
  469. Name string `json:",omitempty"`
  470. // Source is the source location of the mount.
  471. //
  472. // For volumes, this contains the storage location of the volume (within
  473. // `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains
  474. // the source (host) part of the bind-mount. For `tmpfs` mount points, this
  475. // field is empty.
  476. Source string
  477. // Destination is the path relative to the container root (`/`) where the
  478. // Source is mounted inside the container.
  479. Destination string
  480. // Driver is the volume driver used to create the volume (if it is a volume).
  481. Driver string `json:",omitempty"`
  482. // Mode is a comma separated list of options supplied by the user when
  483. // creating the bind/volume mount.
  484. //
  485. // The default is platform-specific (`"z"` on Linux, empty on Windows).
  486. Mode string
  487. // RW indicates whether the mount is mounted writable (read-write).
  488. RW bool
  489. // Propagation describes how mounts are propagated from the host into the
  490. // mount point, and vice-versa. Refer to the Linux kernel documentation
  491. // for details:
  492. // https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt
  493. //
  494. // This field is not used on Windows.
  495. Propagation mount.Propagation
  496. }
  497. // NetworkResource is the body of the "get network" http response message
  498. type NetworkResource struct {
  499. Name string // Name is the requested name of the network
  500. ID string `json:"Id"` // ID uniquely identifies a network on a single machine
  501. Created time.Time // Created is the time the network created
  502. Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level)
  503. Driver string // Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`)
  504. EnableIPv6 bool // EnableIPv6 represents whether to enable IPv6
  505. IPAM network.IPAM // IPAM is the network's IP Address Management
  506. Internal bool // Internal represents if the network is used internal only
  507. Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode.
  508. Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster.
  509. ConfigFrom network.ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network.
  510. ConfigOnly bool // ConfigOnly networks are place-holder networks for network configurations to be used by other networks. ConfigOnly networks cannot be used directly to run containers or services.
  511. Containers map[string]EndpointResource // Containers contains endpoints belonging to the network
  512. Options map[string]string // Options holds the network specific options to use for when creating the network
  513. Labels map[string]string // Labels holds metadata specific to the network being created
  514. Peers []network.PeerInfo `json:",omitempty"` // List of peer nodes for an overlay network
  515. Services map[string]network.ServiceInfo `json:",omitempty"`
  516. }
  517. // EndpointResource contains network resources allocated and used for a container in a network
  518. type EndpointResource struct {
  519. Name string
  520. EndpointID string
  521. MacAddress string
  522. IPv4Address string
  523. IPv6Address string
  524. }
  525. // NetworkCreate is the expected body of the "create network" http request message
  526. type NetworkCreate struct {
  527. // Check for networks with duplicate names.
  528. // Network is primarily keyed based on a random ID and not on the name.
  529. // Network name is strictly a user-friendly alias to the network
  530. // which is uniquely identified using ID.
  531. // And there is no guaranteed way to check for duplicates.
  532. // Option CheckDuplicate is there to provide a best effort checking of any networks
  533. // which has the same name but it is not guaranteed to catch all name collisions.
  534. CheckDuplicate bool
  535. Driver string
  536. Scope string
  537. EnableIPv6 bool
  538. IPAM *network.IPAM
  539. Internal bool
  540. Attachable bool
  541. Ingress bool
  542. ConfigOnly bool
  543. ConfigFrom *network.ConfigReference
  544. Options map[string]string
  545. Labels map[string]string
  546. }
  547. // NetworkCreateRequest is the request message sent to the server for network create call.
  548. type NetworkCreateRequest struct {
  549. NetworkCreate
  550. Name string
  551. }
  552. // NetworkCreateResponse is the response message sent by the server for network create call
  553. type NetworkCreateResponse struct {
  554. ID string `json:"Id"`
  555. Warning string
  556. }
  557. // NetworkConnect represents the data to be used to connect a container to the network
  558. type NetworkConnect struct {
  559. Container string
  560. EndpointConfig *network.EndpointSettings `json:",omitempty"`
  561. }
  562. // NetworkDisconnect represents the data to be used to disconnect a container from the network
  563. type NetworkDisconnect struct {
  564. Container string
  565. Force bool
  566. }
  567. // NetworkInspectOptions holds parameters to inspect network
  568. type NetworkInspectOptions struct {
  569. Scope string
  570. Verbose bool
  571. }
  572. // Checkpoint represents the details of a checkpoint
  573. type Checkpoint struct {
  574. Name string // Name is the name of the checkpoint
  575. }
  576. // Runtime describes an OCI runtime
  577. type Runtime struct {
  578. Path string `json:"path"`
  579. Args []string `json:"runtimeArgs,omitempty"`
  580. // This is exposed here only for internal use
  581. // It is not currently supported to specify custom shim configs
  582. Shim *ShimConfig `json:"-"`
  583. }
  584. // ShimConfig is used by runtime to configure containerd shims
  585. type ShimConfig struct {
  586. Binary string
  587. Opts interface{}
  588. }
  589. // DiskUsageObject represents an object type used for disk usage query filtering.
  590. type DiskUsageObject string
  591. const (
  592. // ContainerObject represents a container DiskUsageObject.
  593. ContainerObject DiskUsageObject = "container"
  594. // ImageObject represents an image DiskUsageObject.
  595. ImageObject DiskUsageObject = "image"
  596. // VolumeObject represents a volume DiskUsageObject.
  597. VolumeObject DiskUsageObject = "volume"
  598. // BuildCacheObject represents a build-cache DiskUsageObject.
  599. BuildCacheObject DiskUsageObject = "build-cache"
  600. )
  601. // DiskUsageOptions holds parameters for system disk usage query.
  602. type DiskUsageOptions struct {
  603. // Types specifies what object types to include in the response. If empty,
  604. // all object types are returned.
  605. Types []DiskUsageObject
  606. }
  607. // DiskUsage contains response of Engine API:
  608. // GET "/system/df"
  609. type DiskUsage struct {
  610. LayersSize int64
  611. Images []*ImageSummary
  612. Containers []*Container
  613. Volumes []*volume.Volume
  614. BuildCache []*BuildCache
  615. BuilderSize int64 `json:",omitempty"` // Deprecated: deprecated in API 1.38, and no longer used since API 1.40.
  616. }
  617. // ContainersPruneReport contains the response for Engine API:
  618. // POST "/containers/prune"
  619. type ContainersPruneReport struct {
  620. ContainersDeleted []string
  621. SpaceReclaimed uint64
  622. }
  623. // VolumesPruneReport contains the response for Engine API:
  624. // POST "/volumes/prune"
  625. type VolumesPruneReport struct {
  626. VolumesDeleted []string
  627. SpaceReclaimed uint64
  628. }
  629. // ImagesPruneReport contains the response for Engine API:
  630. // POST "/images/prune"
  631. type ImagesPruneReport struct {
  632. ImagesDeleted []ImageDeleteResponseItem
  633. SpaceReclaimed uint64
  634. }
  635. // BuildCachePruneReport contains the response for Engine API:
  636. // POST "/build/prune"
  637. type BuildCachePruneReport struct {
  638. CachesDeleted []string
  639. SpaceReclaimed uint64
  640. }
  641. // NetworksPruneReport contains the response for Engine API:
  642. // POST "/networks/prune"
  643. type NetworksPruneReport struct {
  644. NetworksDeleted []string
  645. }
  646. // SecretCreateResponse contains the information returned to a client
  647. // on the creation of a new secret.
  648. type SecretCreateResponse struct {
  649. // ID is the id of the created secret.
  650. ID string
  651. }
  652. // SecretListOptions holds parameters to list secrets
  653. type SecretListOptions struct {
  654. Filters filters.Args
  655. }
  656. // ConfigCreateResponse contains the information returned to a client
  657. // on the creation of a new config.
  658. type ConfigCreateResponse struct {
  659. // ID is the id of the created config.
  660. ID string
  661. }
  662. // ConfigListOptions holds parameters to list configs
  663. type ConfigListOptions struct {
  664. Filters filters.Args
  665. }
  666. // PushResult contains the tag, manifest digest, and manifest size from the
  667. // push. It's used to signal this information to the trust code in the client
  668. // so it can sign the manifest if necessary.
  669. type PushResult struct {
  670. Tag string
  671. Digest string
  672. Size int
  673. }
  674. // BuildResult contains the image id of a successful build
  675. type BuildResult struct {
  676. ID string
  677. }
  678. // BuildCache contains information about a build cache record
  679. type BuildCache struct {
  680. ID string
  681. Parent string
  682. Type string
  683. Description string
  684. InUse bool
  685. Shared bool
  686. Size int64
  687. CreatedAt time.Time
  688. LastUsedAt *time.Time
  689. UsageCount int
  690. }
  691. // BuildCachePruneOptions hold parameters to prune the build cache
  692. type BuildCachePruneOptions struct {
  693. All bool
  694. KeepStorage int64
  695. Filters filters.Args
  696. }