mirror of
https://github.com/moby/moby.git
synced 2026-08-13 17:06:44 +00:00
This moves the `Port` type to the container package, and deprecates the old location. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
368 lines
12 KiB
Go
368 lines
12 KiB
Go
package types // import "github.com/docker/docker/api/types"
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/docker/docker/api/types/container"
|
|
"github.com/docker/docker/api/types/filters"
|
|
"github.com/docker/docker/api/types/image"
|
|
"github.com/docker/docker/api/types/swarm"
|
|
"github.com/docker/docker/api/types/volume"
|
|
)
|
|
|
|
const (
|
|
// MediaTypeRawStream is vendor specific MIME-Type set for raw TTY streams
|
|
MediaTypeRawStream = "application/vnd.docker.raw-stream"
|
|
|
|
// MediaTypeMultiplexedStream is vendor specific MIME-Type set for stdin/stdout/stderr multiplexed streams
|
|
MediaTypeMultiplexedStream = "application/vnd.docker.multiplexed-stream"
|
|
)
|
|
|
|
// RootFS returns Image's RootFS description including the layer IDs.
|
|
type RootFS struct {
|
|
Type string `json:",omitempty"`
|
|
Layers []string `json:",omitempty"`
|
|
}
|
|
|
|
// ImageInspect contains response of Engine API:
|
|
// GET "/images/{name:.*}/json"
|
|
type ImageInspect struct {
|
|
// ID is the content-addressable ID of an image.
|
|
//
|
|
// This identifier is a content-addressable digest calculated from the
|
|
// image's configuration (which includes the digests of layers used by
|
|
// the image).
|
|
//
|
|
// Note that this digest differs from the `RepoDigests` below, which
|
|
// holds digests of image manifests that reference the image.
|
|
ID string `json:"Id"`
|
|
|
|
// RepoTags is a list of image names/tags in the local image cache that
|
|
// reference this image.
|
|
//
|
|
// Multiple image tags can refer to the same image, and this list may be
|
|
// empty if no tags reference the image, in which case the image is
|
|
// "untagged", in which case it can still be referenced by its ID.
|
|
RepoTags []string
|
|
|
|
// RepoDigests is a list of content-addressable digests of locally available
|
|
// image manifests that the image is referenced from. Multiple manifests can
|
|
// refer to the same image.
|
|
//
|
|
// These digests are usually only available if the image was either pulled
|
|
// from a registry, or if the image was pushed to a registry, which is when
|
|
// the manifest is generated and its digest calculated.
|
|
RepoDigests []string
|
|
|
|
// Parent is the ID of the parent image.
|
|
//
|
|
// Depending on how the image was created, this field may be empty and
|
|
// is only set for images that were built/created locally. This field
|
|
// is empty if the image was pulled from an image registry.
|
|
Parent string
|
|
|
|
// Comment is an optional message that can be set when committing or
|
|
// importing the image.
|
|
Comment string
|
|
|
|
// Created is the date and time at which the image was created, formatted in
|
|
// RFC 3339 nano-seconds (time.RFC3339Nano).
|
|
//
|
|
// This information is only available if present in the image,
|
|
// and omitted otherwise.
|
|
Created string `json:",omitempty"`
|
|
|
|
// Container is the ID of the container that was used to create the image.
|
|
//
|
|
// Depending on how the image was created, this field may be empty.
|
|
//
|
|
// Deprecated: this field is omitted in API v1.45, but kept for backward compatibility.
|
|
Container string `json:",omitempty"`
|
|
|
|
// ContainerConfig is an optional field containing the configuration of the
|
|
// container that was last committed when creating the image.
|
|
//
|
|
// Previous versions of Docker builder used this field to store build cache,
|
|
// and it is not in active use anymore.
|
|
//
|
|
// Deprecated: this field is omitted in API v1.45, but kept for backward compatibility.
|
|
ContainerConfig *container.Config `json:",omitempty"`
|
|
|
|
// DockerVersion is the version of Docker that was used to build the image.
|
|
//
|
|
// Depending on how the image was created, this field may be empty.
|
|
DockerVersion string
|
|
|
|
// Author is the name of the author that was specified when committing the
|
|
// image, or as specified through MAINTAINER (deprecated) in the Dockerfile.
|
|
Author string
|
|
Config *container.Config
|
|
|
|
// Architecture is the hardware CPU architecture that the image runs on.
|
|
Architecture string
|
|
|
|
// Variant is the CPU architecture variant (presently ARM-only).
|
|
Variant string `json:",omitempty"`
|
|
|
|
// OS is the Operating System the image is built to run on.
|
|
Os string
|
|
|
|
// OsVersion is the version of the Operating System the image is built to
|
|
// run on (especially for Windows).
|
|
OsVersion string `json:",omitempty"`
|
|
|
|
// Size is the total size of the image including all layers it is composed of.
|
|
Size int64
|
|
|
|
// VirtualSize is the total size of the image including all layers it is
|
|
// composed of.
|
|
//
|
|
// Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
|
|
VirtualSize int64 `json:"VirtualSize,omitempty"`
|
|
|
|
// GraphDriver holds information about the storage driver used to store the
|
|
// container's and image's filesystem.
|
|
GraphDriver GraphDriverData
|
|
|
|
// RootFS contains information about the image's RootFS, including the
|
|
// layer IDs.
|
|
RootFS RootFS
|
|
|
|
// Metadata of the image in the local cache.
|
|
//
|
|
// This information is local to the daemon, and not part of the image itself.
|
|
Metadata image.Metadata
|
|
}
|
|
|
|
// Container contains response of Engine API:
|
|
// GET "/containers/json"
|
|
type Container struct {
|
|
ID string `json:"Id"`
|
|
Names []string
|
|
Image string
|
|
ImageID string
|
|
Command string
|
|
Created int64
|
|
Ports []container.Port
|
|
SizeRw int64 `json:",omitempty"`
|
|
SizeRootFs int64 `json:",omitempty"`
|
|
Labels map[string]string
|
|
State string
|
|
Status string
|
|
HostConfig struct {
|
|
NetworkMode string `json:",omitempty"`
|
|
Annotations map[string]string `json:",omitempty"`
|
|
}
|
|
NetworkSettings *container.NetworkSettingsSummary
|
|
Mounts []container.MountPoint
|
|
}
|
|
|
|
// Ping contains response of Engine API:
|
|
// GET "/_ping"
|
|
type Ping struct {
|
|
APIVersion string
|
|
OSType string
|
|
Experimental bool
|
|
BuilderVersion BuilderVersion
|
|
|
|
// SwarmStatus provides information about the current swarm status of the
|
|
// engine, obtained from the "Swarm" header in the API response.
|
|
//
|
|
// It can be a nil struct if the API version does not provide this header
|
|
// in the ping response, or if an error occurred, in which case the client
|
|
// should use other ways to get the current swarm status, such as the /swarm
|
|
// endpoint.
|
|
SwarmStatus *swarm.Status
|
|
}
|
|
|
|
// ComponentVersion describes the version information for a specific component.
|
|
type ComponentVersion struct {
|
|
Name string
|
|
Version string
|
|
Details map[string]string `json:",omitempty"`
|
|
}
|
|
|
|
// Version contains response of Engine API:
|
|
// GET "/version"
|
|
type Version struct {
|
|
Platform struct{ Name string } `json:",omitempty"`
|
|
Components []ComponentVersion `json:",omitempty"`
|
|
|
|
// The following fields are deprecated, they relate to the Engine component and are kept for backwards compatibility
|
|
|
|
Version string
|
|
APIVersion string `json:"ApiVersion"`
|
|
MinAPIVersion string `json:"MinAPIVersion,omitempty"`
|
|
GitCommit string
|
|
GoVersion string
|
|
Os string
|
|
Arch string
|
|
KernelVersion string `json:",omitempty"`
|
|
Experimental bool `json:",omitempty"`
|
|
BuildTime string `json:",omitempty"`
|
|
}
|
|
|
|
// ContainerState stores container's running state
|
|
// it's part of ContainerJSONBase and will return by "inspect" command
|
|
type ContainerState struct {
|
|
Status string // String representation of the container state. Can be one of "created", "running", "paused", "restarting", "removing", "exited", or "dead"
|
|
Running bool
|
|
Paused bool
|
|
Restarting bool
|
|
OOMKilled bool
|
|
Dead bool
|
|
Pid int
|
|
ExitCode int
|
|
Error string
|
|
StartedAt string
|
|
FinishedAt string
|
|
Health *container.Health `json:",omitempty"`
|
|
}
|
|
|
|
// ContainerJSONBase contains response of Engine API:
|
|
// GET "/containers/{name:.*}/json"
|
|
type ContainerJSONBase struct {
|
|
ID string `json:"Id"`
|
|
Created string
|
|
Path string
|
|
Args []string
|
|
State *ContainerState
|
|
Image string
|
|
ResolvConfPath string
|
|
HostnamePath string
|
|
HostsPath string
|
|
LogPath string
|
|
Node *ContainerNode `json:",omitempty"` // Deprecated: Node was only propagated by Docker Swarm standalone API. It sill be removed in the next release.
|
|
Name string
|
|
RestartCount int
|
|
Driver string
|
|
Platform string
|
|
MountLabel string
|
|
ProcessLabel string
|
|
AppArmorProfile string
|
|
ExecIDs []string
|
|
HostConfig *container.HostConfig
|
|
GraphDriver GraphDriverData
|
|
SizeRw *int64 `json:",omitempty"`
|
|
SizeRootFs *int64 `json:",omitempty"`
|
|
}
|
|
|
|
// ContainerJSON is newly used struct along with MountPoint
|
|
type ContainerJSON struct {
|
|
*ContainerJSONBase
|
|
Mounts []container.MountPoint
|
|
Config *container.Config
|
|
NetworkSettings *container.NetworkSettings
|
|
}
|
|
|
|
// DiskUsageObject represents an object type used for disk usage query filtering.
|
|
type DiskUsageObject string
|
|
|
|
const (
|
|
// ContainerObject represents a container DiskUsageObject.
|
|
ContainerObject DiskUsageObject = "container"
|
|
// ImageObject represents an image DiskUsageObject.
|
|
ImageObject DiskUsageObject = "image"
|
|
// VolumeObject represents a volume DiskUsageObject.
|
|
VolumeObject DiskUsageObject = "volume"
|
|
// BuildCacheObject represents a build-cache DiskUsageObject.
|
|
BuildCacheObject DiskUsageObject = "build-cache"
|
|
)
|
|
|
|
// DiskUsageOptions holds parameters for system disk usage query.
|
|
type DiskUsageOptions struct {
|
|
// Types specifies what object types to include in the response. If empty,
|
|
// all object types are returned.
|
|
Types []DiskUsageObject
|
|
}
|
|
|
|
// DiskUsage contains response of Engine API:
|
|
// GET "/system/df"
|
|
type DiskUsage struct {
|
|
LayersSize int64
|
|
Images []*image.Summary
|
|
Containers []*Container
|
|
Volumes []*volume.Volume
|
|
BuildCache []*BuildCache
|
|
BuilderSize int64 `json:",omitempty"` // Deprecated: deprecated in API 1.38, and no longer used since API 1.40.
|
|
}
|
|
|
|
// BuildCachePruneReport contains the response for Engine API:
|
|
// POST "/build/prune"
|
|
type BuildCachePruneReport struct {
|
|
CachesDeleted []string
|
|
SpaceReclaimed uint64
|
|
}
|
|
|
|
// SecretCreateResponse contains the information returned to a client
|
|
// on the creation of a new secret.
|
|
type SecretCreateResponse struct {
|
|
// ID is the id of the created secret.
|
|
ID string
|
|
}
|
|
|
|
// SecretListOptions holds parameters to list secrets
|
|
type SecretListOptions struct {
|
|
Filters filters.Args
|
|
}
|
|
|
|
// ConfigCreateResponse contains the information returned to a client
|
|
// on the creation of a new config.
|
|
type ConfigCreateResponse struct {
|
|
// ID is the id of the created config.
|
|
ID string
|
|
}
|
|
|
|
// ConfigListOptions holds parameters to list configs
|
|
type ConfigListOptions struct {
|
|
Filters filters.Args
|
|
}
|
|
|
|
// PushResult contains the tag, manifest digest, and manifest size from the
|
|
// push. It's used to signal this information to the trust code in the client
|
|
// so it can sign the manifest if necessary.
|
|
type PushResult struct {
|
|
Tag string
|
|
Digest string
|
|
Size int
|
|
}
|
|
|
|
// BuildResult contains the image id of a successful build
|
|
type BuildResult struct {
|
|
ID string
|
|
}
|
|
|
|
// BuildCache contains information about a build cache record.
|
|
type BuildCache struct {
|
|
// ID is the unique ID of the build cache record.
|
|
ID string
|
|
// Parent is the ID of the parent build cache record.
|
|
//
|
|
// Deprecated: deprecated in API v1.42 and up, as it was deprecated in BuildKit; use Parents instead.
|
|
Parent string `json:"Parent,omitempty"`
|
|
// Parents is the list of parent build cache record IDs.
|
|
Parents []string `json:" Parents,omitempty"`
|
|
// Type is the cache record type.
|
|
Type string
|
|
// Description is a description of the build-step that produced the build cache.
|
|
Description string
|
|
// InUse indicates if the build cache is in use.
|
|
InUse bool
|
|
// Shared indicates if the build cache is shared.
|
|
Shared bool
|
|
// Size is the amount of disk space used by the build cache (in bytes).
|
|
Size int64
|
|
// CreatedAt is the date and time at which the build cache was created.
|
|
CreatedAt time.Time
|
|
// LastUsedAt is the date and time at which the build cache was last used.
|
|
LastUsedAt *time.Time
|
|
UsageCount int
|
|
}
|
|
|
|
// BuildCachePruneOptions hold parameters to prune the build cache
|
|
type BuildCachePruneOptions struct {
|
|
All bool
|
|
KeepStorage int64
|
|
Filters filters.Args
|
|
}
|