types.go 27 KB

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