github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/api/types/types.go (about)

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