types.go 27 KB

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