Documentation ¶
Overview ¶
Package daemon exposes the functions that occur on the host server that the Docker daemon is running.
In implementing the various functions of the daemon, there is often a method-specific struct for configuring the runtime behavior.
Index ¶
- Constants
- Variables
- func CreateDaemonRoot(config *config.Config) error
- func IsRunningSystemd() bool
- func ModifyRootKeyLimit() error
- func UsingSystemd(config *config.Config) bool
- func VerifyCgroupDriver(config *config.Config) error
- func WithApparmor(c *container.Container) coci.SpecOpts
- func WithCapabilities(c *container.Container) coci.SpecOpts
- func WithCgroups(daemon *Daemon, c *container.Container) coci.SpecOpts
- func WithCommonOptions(daemon *Daemon, c *container.Container) coci.SpecOpts
- func WithDevices(daemon *Daemon, c *container.Container) coci.SpecOpts
- func WithLibnetwork(daemon *Daemon, c *container.Container) coci.SpecOpts
- func WithMounts(daemon *Daemon, c *container.Container) coci.SpecOpts
- func WithNamespaces(daemon *Daemon, c *container.Container) coci.SpecOpts
- func WithOOMScore(score *int) coci.SpecOpts
- func WithResources(c *container.Container) coci.SpecOpts
- func WithRlimits(daemon *Daemon, c *container.Container) coci.SpecOpts
- func WithRootless(daemon *Daemon) coci.SpecOpts
- func WithSeccomp(daemon *Daemon, c *container.Container) coci.SpecOpts
- func WithSelinux(c *container.Container) coci.SpecOpts
- func WithSysctls(c *container.Container) coci.SpecOpts
- func WithUser(c *container.Container) coci.SpecOpts
- type Cluster
- type ClusterStatus
- type Daemon
- func (daemon *Daemon) ActivateContainerServiceBinding(containerName string) error
- func (daemon *Daemon) AuthenticateToRegistry(ctx context.Context, authConfig *types.AuthConfig) (string, string, error)
- func (daemon *Daemon) BuilderBackend() builder.Backend
- func (daemon *Daemon) CheckpointCreate(name string, config types.CheckpointCreateOptions) error
- func (daemon *Daemon) CheckpointDelete(name string, config types.CheckpointDeleteOptions) error
- func (daemon *Daemon) CheckpointList(name string, config types.CheckpointListOptions) ([]types.Checkpoint, error)
- func (daemon *Daemon) Cleanup(container *container.Container)
- func (daemon *Daemon) ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error
- func (daemon *Daemon) ConnectToNetwork(container *container.Container, idOrName string, ...) error
- func (daemon *Daemon) ContainerArchivePath(name string, path string) (content io.ReadCloser, stat *types.ContainerPathStat, err error)
- func (daemon *Daemon) ContainerAttach(prefixOrName string, c *backend.ContainerAttachConfig) error
- func (daemon *Daemon) ContainerAttachRaw(prefixOrName string, stdin io.ReadCloser, stdout, stderr io.Writer, ...) error
- func (daemon *Daemon) ContainerChanges(name string) ([]archive.Change, error)
- func (daemon *Daemon) ContainerCopy(name string, res string) (io.ReadCloser, error)
- func (daemon *Daemon) ContainerCreate(params types.ContainerCreateConfig) (containertypes.ContainerCreateCreatedBody, error)
- func (daemon *Daemon) ContainerCreateIgnoreImagesArgsEscaped(params types.ContainerCreateConfig) (containertypes.ContainerCreateCreatedBody, error)
- func (daemon *Daemon) ContainerCreateWorkdir(cID string) error
- func (daemon *Daemon) ContainerExecCreate(name string, config *types.ExecConfig) (string, error)
- func (daemon *Daemon) ContainerExecInspect(id string) (*backend.ExecInspect, error)
- func (daemon *Daemon) ContainerExecResize(name string, height, width int) error
- func (daemon *Daemon) ContainerExecStart(ctx context.Context, name string, stdin io.Reader, stdout io.Writer, ...) (err error)
- func (daemon *Daemon) ContainerExport(name string, out io.Writer) error
- func (daemon *Daemon) ContainerExtractToDir(name, path string, copyUIDGID, noOverwriteDirNonDir bool, content io.Reader) error
- func (daemon *Daemon) ContainerInspect(name string, size bool, version string) (interface{}, error)
- func (daemon *Daemon) ContainerInspectCurrent(name string, size bool) (*types.ContainerJSON, error)
- func (daemon *Daemon) ContainerKill(name string, sig uint64) error
- func (daemon *Daemon) ContainerLogs(ctx context.Context, containerName string, config *types.ContainerLogsOptions) (messages <-chan *backend.LogMessage, isTTY bool, retErr error)
- func (daemon *Daemon) ContainerPause(name string) error
- func (daemon *Daemon) ContainerRename(oldName, newName string) error
- func (daemon *Daemon) ContainerResize(name string, height, width int) error
- func (daemon *Daemon) ContainerRestart(name string, seconds *int) error
- func (daemon *Daemon) ContainerRm(name string, config *types.ContainerRmConfig) error
- func (daemon *Daemon) ContainerStart(name string, hostConfig *containertypes.HostConfig, checkpoint string, ...) error
- func (daemon *Daemon) ContainerStatPath(name string, path string) (stat *types.ContainerPathStat, err error)
- func (daemon *Daemon) ContainerStats(ctx context.Context, prefixOrName string, config *backend.ContainerStatsConfig) error
- func (daemon *Daemon) ContainerStop(name string, timeout *int) error
- func (daemon *Daemon) ContainerTop(name string, psArgs string) (*container.ContainerTopOKBody, error)
- func (daemon *Daemon) ContainerUnpause(name string) error
- func (daemon *Daemon) ContainerUpdate(name string, hostConfig *container.HostConfig) (container.ContainerUpdateOKBody, error)
- func (daemon *Daemon) ContainerWait(ctx context.Context, name string, condition container.WaitCondition) (<-chan container.StateStatus, error)
- func (daemon *Daemon) Containers(config *types.ContainerListOptions) ([]*types.Container, error)
- func (daemon *Daemon) ContainersPrune(ctx context.Context, pruneFilters filters.Args) (*types.ContainersPruneReport, error)
- func (daemon *Daemon) CreateImageFromContainer(name string, c *backend.CreateImageConfig) (string, error)
- func (daemon *Daemon) CreateManagedContainer(params types.ContainerCreateConfig) (containertypes.ContainerCreateCreatedBody, error)
- func (daemon *Daemon) CreateManagedNetwork(create clustertypes.NetworkCreateRequest) error
- func (daemon *Daemon) CreateNetwork(create types.NetworkCreateRequest) (*types.NetworkCreateResponse, error)
- func (daemon *Daemon) DaemonJoinsCluster(clusterProvider cluster.Provider)
- func (daemon *Daemon) DaemonLeavesCluster()
- func (daemon *Daemon) DeactivateContainerServiceBinding(containerName string) error
- func (daemon *Daemon) DeleteManagedNetwork(networkID string) error
- func (daemon *Daemon) DeleteNetwork(networkID string) error
- func (daemon *Daemon) DisconnectContainerFromNetwork(containerName string, networkName string, force bool) error
- func (daemon *Daemon) DisconnectFromNetwork(container *container.Container, networkName string, force bool) error
- func (daemon *Daemon) DistributionServices() images.DistributionServices
- func (daemon *Daemon) ExecExists(name string) (bool, error)
- func (daemon *Daemon) Exists(id string) bool
- func (daemon *Daemon) Features() *map[string]bool
- func (daemon *Daemon) FindNetwork(term string) (libnetwork.Network, error)
- func (daemon *Daemon) ForceEndpointDelete(name string, networkName string) error
- func (daemon *Daemon) GetAttachmentStore() *network.AttachmentStore
- func (daemon *Daemon) GetByName(name string) (*container.Container, error)
- func (daemon *Daemon) GetCluster() Cluster
- func (daemon *Daemon) GetContainer(prefixOrName string) (*container.Container, error)
- func (daemon *Daemon) GetContainerStats(container *container.Container) (*types.StatsJSON, error)
- func (daemon *Daemon) GetNetworkByID(id string) (libnetwork.Network, error)
- func (daemon *Daemon) GetNetworkByName(name string) (libnetwork.Network, error)
- func (daemon *Daemon) GetNetworkDriverList() []string
- func (daemon *Daemon) GetNetworks(filter filters.Args, config types.NetworkListConfig) ([]types.NetworkResource, error)
- func (daemon *Daemon) GetNetworksByIDPrefix(partialID string) []libnetwork.Network
- func (daemon *Daemon) HasExperimental() bool
- func (daemon *Daemon) IdentityMapping() *idtools.IdentityMapping
- func (daemon *Daemon) ImageService() *images.ImageService
- func (daemon *Daemon) IsPaused(id string) bool
- func (daemon *Daemon) IsShuttingDown() bool
- func (daemon *Daemon) IsSwarmCompatible() error
- func (daemon *Daemon) Kill(container *containerpkg.Container) error
- func (daemon *Daemon) List() []*container.Container
- func (daemon *Daemon) LogContainerEvent(container *container.Container, action string)
- func (daemon *Daemon) LogContainerEventWithAttributes(container *container.Container, action string, attributes map[string]string)
- func (daemon *Daemon) LogDaemonEventWithAttributes(action string, attributes map[string]string)
- func (daemon *Daemon) LogNetworkEvent(nw libnetwork.Network, action string)
- func (daemon *Daemon) LogNetworkEventWithAttributes(nw libnetwork.Network, action string, attributes map[string]string)
- func (daemon *Daemon) LogPluginEvent(pluginID, refName, action string)
- func (daemon *Daemon) LogPluginEventWithAttributes(pluginID, refName, action string, attributes map[string]string)
- func (daemon *Daemon) LogVolumeEvent(volumeID, action string, attributes map[string]string)
- func (daemon *Daemon) Mount(container *container.Container) error
- func (daemon *Daemon) NetworkController() libnetwork.NetworkController
- func (daemon *Daemon) NetworkControllerEnabled() bool
- func (daemon *Daemon) NetworksPrune(ctx context.Context, pruneFilters filters.Args) (*types.NetworksPruneReport, error)
- func (daemon *Daemon) PluginGetter() *plugin.Store
- func (daemon *Daemon) PluginManager() *plugin.Manager
- func (daemon *Daemon) ProcessClusterNotifications(ctx context.Context, watchStream chan *swarmapi.WatchMessage)
- func (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei libcontainerdtypes.EventInfo) error
- func (daemon *Daemon) RawSysInfo(quiet bool) *sysinfo.SysInfo
- func (daemon *Daemon) Register(c *container.Container) error
- func (daemon *Daemon) RegistryHosts() docker.RegistryHosts
- func (daemon *Daemon) ReleaseIngress() (<-chan struct{}, error)
- func (daemon *Daemon) Reload(conf *config.Config) (err error)
- func (daemon *Daemon) RestartSwarmContainers()
- func (daemon *Daemon) Rootless() bool
- func (daemon *Daemon) SetCluster(cluster Cluster)
- func (daemon *Daemon) SetContainerConfigReferences(name string, refs []*swarmtypes.ConfigReference) error
- func (daemon *Daemon) SetContainerDependencyStore(name string, store exec.DependencyGetter) error
- func (daemon *Daemon) SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error
- func (daemon *Daemon) SetNetworkBootstrapKeys(keys []*networktypes.EncryptionKey) error
- func (daemon *Daemon) SetupIngress(create clustertypes.NetworkCreateRequest, nodeIP string) (<-chan struct{}, error)
- func (daemon *Daemon) Shutdown() error
- func (daemon *Daemon) ShutdownTimeout() int
- func (daemon *Daemon) StoreHosts(hosts []string)
- func (daemon *Daemon) Subnets() ([]net.IPNet, []net.IPNet)
- func (daemon *Daemon) SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan interface{})
- func (daemon *Daemon) SystemDiskUsage(ctx context.Context) (*types.DiskUsage, error)
- func (daemon *Daemon) SystemInfo() *types.Info
- func (daemon *Daemon) SystemVersion() types.Version
- func (daemon *Daemon) Unmount(container *container.Container) error
- func (daemon *Daemon) UnsubscribeFromEvents(listener chan interface{})
- func (daemon *Daemon) UpdateAttachment(networkName, networkID, containerID string, config *network.NetworkingConfig) error
- func (daemon *Daemon) UpdateContainerServiceConfig(containerName string, serviceConfig *clustertypes.ServiceConfig) error
- func (daemon *Daemon) VolumesService() *service.VolumesService
- func (daemon *Daemon) WaitForDetachment(ctx context.Context, networkName, networkID, taskID, containerID string) error
- type NetworkManager
- type PredefinedNetworkError
Constants ¶
const ( // DefaultShimBinary is the default shim to be used by containerd if none // is specified DefaultShimBinary = "containerd-shim" // DefaultRuntimeBinary is the default runtime to be used by // containerd if none is specified DefaultRuntimeBinary = "runc" // DefaultRuntimeName is the default runtime to be used by // containerd if none is specified DefaultRuntimeName = "runc" )
const (
ContainersNamespace = "moby"
)
ContainersNamespace is the name of the namespace used for users containers
Variables ¶
var ErrExtractPointNotDirectory = errors.New("extraction point is not a directory")
ErrExtractPointNotDirectory is used to convey that the operation to extract a tar archive to a directory in a container has failed because the specified path does not refer to a directory.
var ( // ErrRootFSReadOnly is returned when a container // rootfs is marked readonly. ErrRootFSReadOnly = errors.New("container rootfs is marked read-only") )
var ( // ErrVolumeReadonly is used to signal an error when trying to copy data into // a volume mount that is not writable. ErrVolumeReadonly = errors.New("mounted volume is marked read-only") )
Functions ¶
func IsRunningSystemd ¶
func IsRunningSystemd() bool
IsRunningSystemd is from https://github.com/opencontainers/runc/blob/46be7b612e2533c494e6a251111de46d8e286ed5/libcontainer/cgroups/systemd/common.go#L27-L33
func ModifyRootKeyLimit ¶
func ModifyRootKeyLimit() error
ModifyRootKeyLimit checks to see if the root key limit is set to at least 1000000 and changes it to that limit along with the maxbytes allocated to the keys at a 25 to 1 multiplier.
func UsingSystemd ¶
UsingSystemd returns true if cli option includes native.cgroupdriver=systemd
func VerifyCgroupDriver ¶
VerifyCgroupDriver validates native.cgroupdriver
func WithApparmor ¶
WithApparmor sets the apparmor profile
func WithCapabilities ¶
WithCapabilities sets the container's capabilties
func WithCgroups ¶
WithCgroups sets the container's cgroups
func WithCommonOptions ¶
WithCommonOptions sets common docker options
func WithDevices ¶
WithDevices sets the container's devices
func WithLibnetwork ¶
WithLibnetwork sets the libnetwork hook
func WithMounts ¶
WithMounts sets the container's mounts
func WithNamespaces ¶
WithNamespaces sets the container's namespaces
func WithResources ¶
WithResources applies the container resources
func WithRlimits ¶
WithRlimits sets the container's rlimits along with merging the daemon's rlimits
func WithRootless ¶
WithRootless sets the spec to the rootless configuration
func WithSeccomp ¶
WithSeccomp sets the seccomp profile
func WithSelinux ¶
WithSelinux sets the selinux labels
func WithSysctls ¶
WithSysctls sets the container's sysctls
Types ¶
type Cluster ¶
type Cluster interface { ClusterStatus NetworkManager SendClusterEvent(event lncluster.ConfigEventType) }
Cluster is the interface for github.com/docker/docker/daemon/cluster.(*Cluster).
type ClusterStatus ¶
ClusterStatus interface provides information about the Swarm status of the Cluster
type Daemon ¶
type Daemon struct { ID string RegistryService registry.Service EventsService *events.Events PluginStore *plugin.Store // todo: remove // contains filtered or unexported fields }
Daemon holds information about the Docker daemon.
func NewDaemon ¶
func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.Store) (daemon *Daemon, err error)
NewDaemon sets up everything for the daemon to be able to service requests from the webserver.
func (*Daemon) ActivateContainerServiceBinding ¶
ActivateContainerServiceBinding puts this container into load balancer active rotation and DNS response
func (*Daemon) AuthenticateToRegistry ¶
func (daemon *Daemon) AuthenticateToRegistry(ctx context.Context, authConfig *types.AuthConfig) (string, string, error)
AuthenticateToRegistry checks the validity of credentials in authConfig
func (*Daemon) BuilderBackend ¶
BuilderBackend returns the backend used by builder
func (*Daemon) CheckpointCreate ¶
func (daemon *Daemon) CheckpointCreate(name string, config types.CheckpointCreateOptions) error
CheckpointCreate checkpoints the process running in a container with CRIU
func (*Daemon) CheckpointDelete ¶
func (daemon *Daemon) CheckpointDelete(name string, config types.CheckpointDeleteOptions) error
CheckpointDelete deletes the specified checkpoint
func (*Daemon) CheckpointList ¶
func (daemon *Daemon) CheckpointList(name string, config types.CheckpointListOptions) ([]types.Checkpoint, error)
CheckpointList lists all checkpoints of the specified container
func (*Daemon) Cleanup ¶
Cleanup releases any network resources allocated to the container along with any rules around how containers are linked together. It also unmounts the container's root filesystem.
func (*Daemon) ConnectContainerToNetwork ¶
func (daemon *Daemon) ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error
ConnectContainerToNetwork connects the given container to the given network. If either cannot be found, an err is returned. If the network cannot be set up, an err is returned.
func (*Daemon) ConnectToNetwork ¶
func (daemon *Daemon) ConnectToNetwork(container *container.Container, idOrName string, endpointConfig *networktypes.EndpointSettings) error
ConnectToNetwork connects a container to a network
func (*Daemon) ContainerArchivePath ¶
func (daemon *Daemon) ContainerArchivePath(name string, path string) (content io.ReadCloser, stat *types.ContainerPathStat, err error)
ContainerArchivePath creates an archive of the filesystem resource at the specified path in the container identified by the given name. Returns a tar archive of the resource and whether it was a directory or a single file.
func (*Daemon) ContainerAttach ¶
func (daemon *Daemon) ContainerAttach(prefixOrName string, c *backend.ContainerAttachConfig) error
ContainerAttach attaches to logs according to the config passed in. See ContainerAttachConfig.
func (*Daemon) ContainerAttachRaw ¶
func (daemon *Daemon) ContainerAttachRaw(prefixOrName string, stdin io.ReadCloser, stdout, stderr io.Writer, doStream bool, attached chan struct{}) error
ContainerAttachRaw attaches the provided streams to the container's stdio
func (*Daemon) ContainerChanges ¶
ContainerChanges returns a list of container fs changes
func (*Daemon) ContainerCopy ¶
ContainerCopy performs a deprecated operation of archiving the resource at the specified path in the container identified by the given name.
func (*Daemon) ContainerCreate ¶
func (daemon *Daemon) ContainerCreate(params types.ContainerCreateConfig) (containertypes.ContainerCreateCreatedBody, error)
ContainerCreate creates a regular container
func (*Daemon) ContainerCreateIgnoreImagesArgsEscaped ¶
func (daemon *Daemon) ContainerCreateIgnoreImagesArgsEscaped(params types.ContainerCreateConfig) (containertypes.ContainerCreateCreatedBody, error)
ContainerCreateIgnoreImagesArgsEscaped creates a regular container. This is called from the builder RUN case and ensures that we do not take the images ArgsEscaped
func (*Daemon) ContainerCreateWorkdir ¶
ContainerCreateWorkdir creates the working directory. This solves the issue arising from https://github.com/docker/docker/issues/27545, which was initially fixed by https://github.com/docker/docker/pull/27884. But that fix was too expensive in terms of performance on Windows. Instead, https://github.com/docker/docker/pull/28514 introduces this new functionality where the builder calls into the backend here to create the working directory.
func (*Daemon) ContainerExecCreate ¶
ContainerExecCreate sets up an exec in a running container.
func (*Daemon) ContainerExecInspect ¶
func (daemon *Daemon) ContainerExecInspect(id string) (*backend.ExecInspect, error)
ContainerExecInspect returns low-level information about the exec command. An error is returned if the exec cannot be found.
func (*Daemon) ContainerExecResize ¶
ContainerExecResize changes the size of the TTY of the process running in the exec with the given name to the given height and width.
func (*Daemon) ContainerExecStart ¶
func (daemon *Daemon) ContainerExecStart(ctx context.Context, name string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (err error)
ContainerExecStart starts a previously set up exec instance. The std streams are set up. If ctx is cancelled, the process is terminated.
func (*Daemon) ContainerExport ¶
ContainerExport writes the contents of the container to the given writer. An error is returned if the container cannot be found.
func (*Daemon) ContainerExtractToDir ¶
func (daemon *Daemon) ContainerExtractToDir(name, path string, copyUIDGID, noOverwriteDirNonDir bool, content io.Reader) error
ContainerExtractToDir extracts the given archive to the specified location in the filesystem of the container identified by the given name. The given path must be of a directory in the container. If it is not, the error will be ErrExtractPointNotDirectory. If noOverwriteDirNonDir is true then it will be an error if unpacking the given content would cause an existing directory to be replaced with a non-directory and vice versa.
func (*Daemon) ContainerInspect ¶
ContainerInspect returns low-level information about a container. Returns an error if the container cannot be found, or if there is an error getting the data.
func (*Daemon) ContainerInspectCurrent ¶
ContainerInspectCurrent returns low-level information about a container in a most recent api version.
func (*Daemon) ContainerKill ¶
ContainerKill sends signal to the container If no signal is given (sig 0), then Kill with SIGKILL and wait for the container to exit. If a signal is given, then just send it to the container and return.
func (*Daemon) ContainerLogs ¶
func (daemon *Daemon) ContainerLogs(ctx context.Context, containerName string, config *types.ContainerLogsOptions) (messages <-chan *backend.LogMessage, isTTY bool, retErr error)
ContainerLogs copies the container's log channel to the channel provided in the config. If ContainerLogs returns an error, no messages have been copied. and the channel will be closed without data.
if it returns nil, the config channel will be active and return log messages until it runs out or the context is canceled.
func (*Daemon) ContainerPause ¶
ContainerPause pauses a container
func (*Daemon) ContainerRename ¶
ContainerRename changes the name of a container, using the oldName to find the container. An error is returned if newName is already reserved.
func (*Daemon) ContainerResize ¶
ContainerResize changes the size of the TTY of the process running in the container with the given name to the given height and width.
func (*Daemon) ContainerRestart ¶
ContainerRestart stops and starts a container. It attempts to gracefully stop the container within the given timeout, forcefully stopping it if the timeout is exceeded. If given a negative timeout, ContainerRestart will wait forever until a graceful stop. Returns an error if the container cannot be found, or if there is an underlying error at any stage of the restart.
func (*Daemon) ContainerRm ¶
func (daemon *Daemon) ContainerRm(name string, config *types.ContainerRmConfig) error
ContainerRm removes the container id from the filesystem. An error is returned if the container is not found, or if the remove fails. If the remove succeeds, the container name is released, and network links are removed.
func (*Daemon) ContainerStart ¶
func (daemon *Daemon) ContainerStart(name string, hostConfig *containertypes.HostConfig, checkpoint string, checkpointDir string) error
ContainerStart starts a container.
func (*Daemon) ContainerStatPath ¶
func (daemon *Daemon) ContainerStatPath(name string, path string) (stat *types.ContainerPathStat, err error)
ContainerStatPath stats the filesystem resource at the specified path in the container identified by the given name.
func (*Daemon) ContainerStats ¶
func (daemon *Daemon) ContainerStats(ctx context.Context, prefixOrName string, config *backend.ContainerStatsConfig) error
ContainerStats writes information about the container to the stream given in the config object.
func (*Daemon) ContainerStop ¶
ContainerStop looks for the given container and stops it. In case the container fails to stop gracefully within a time duration specified by the timeout argument, in seconds, it is forcefully terminated (killed).
If the timeout is nil, the container's StopTimeout value is used, if set, otherwise the engine default. A negative timeout value can be specified, meaning no timeout, i.e. no forceful termination is performed.
func (*Daemon) ContainerTop ¶
func (daemon *Daemon) ContainerTop(name string, psArgs string) (*container.ContainerTopOKBody, error)
ContainerTop lists the processes running inside of the given container by calling ps with the given args, or with the flags "-ef" if no args are given. An error is returned if the container is not found, or is not running, or if there are any problems running ps, or parsing the output.
func (*Daemon) ContainerUnpause ¶
ContainerUnpause unpauses a container
func (*Daemon) ContainerUpdate ¶
func (daemon *Daemon) ContainerUpdate(name string, hostConfig *container.HostConfig) (container.ContainerUpdateOKBody, error)
ContainerUpdate updates configuration of the container
func (*Daemon) ContainerWait ¶
func (daemon *Daemon) ContainerWait(ctx context.Context, name string, condition container.WaitCondition) (<-chan container.StateStatus, error)
ContainerWait waits until the given container is in a certain state indicated by the given condition. If the container is not found, a nil channel and non-nil error is returned immediately. If the container is found, a status result will be sent on the returned channel once the wait condition is met or if an error occurs waiting for the container (such as a context timeout or cancellation). On a successful wait, the exit code of the container is returned in the status with a non-nil Err() value.
func (*Daemon) Containers ¶
Containers returns the list of containers to show given the user's filtering.
func (*Daemon) ContainersPrune ¶
func (daemon *Daemon) ContainersPrune(ctx context.Context, pruneFilters filters.Args) (*types.ContainersPruneReport, error)
ContainersPrune removes unused containers
func (*Daemon) CreateImageFromContainer ¶
func (daemon *Daemon) CreateImageFromContainer(name string, c *backend.CreateImageConfig) (string, error)
CreateImageFromContainer creates a new image from a container. The container config will be updated by applying the change set to the custom config, then applying that config over the existing container config.
func (*Daemon) CreateManagedContainer ¶
func (daemon *Daemon) CreateManagedContainer(params types.ContainerCreateConfig) (containertypes.ContainerCreateCreatedBody, error)
CreateManagedContainer creates a container that is managed by a Service
func (*Daemon) CreateManagedNetwork ¶
func (daemon *Daemon) CreateManagedNetwork(create clustertypes.NetworkCreateRequest) error
CreateManagedNetwork creates an agent network.
func (*Daemon) CreateNetwork ¶
func (daemon *Daemon) CreateNetwork(create types.NetworkCreateRequest) (*types.NetworkCreateResponse, error)
CreateNetwork creates a network with the given name, driver and other optional parameters
func (*Daemon) DaemonJoinsCluster ¶
DaemonJoinsCluster informs the daemon has joined the cluster and provides the handler to query the cluster component
func (*Daemon) DaemonLeavesCluster ¶
func (daemon *Daemon) DaemonLeavesCluster()
DaemonLeavesCluster informs the daemon has left the cluster
func (*Daemon) DeactivateContainerServiceBinding ¶
DeactivateContainerServiceBinding removes this container from load balancer active rotation, and DNS response
func (*Daemon) DeleteManagedNetwork ¶
DeleteManagedNetwork deletes an agent network. The requirement of networkID is enforced.
func (*Daemon) DeleteNetwork ¶
DeleteNetwork destroys a network unless it's one of docker's predefined networks.
func (*Daemon) DisconnectContainerFromNetwork ¶
func (daemon *Daemon) DisconnectContainerFromNetwork(containerName string, networkName string, force bool) error
DisconnectContainerFromNetwork disconnects the given container from the given network. If either cannot be found, an err is returned.
func (*Daemon) DisconnectFromNetwork ¶
func (daemon *Daemon) DisconnectFromNetwork(container *container.Container, networkName string, force bool) error
DisconnectFromNetwork disconnects container from network n.
func (*Daemon) DistributionServices ¶
func (daemon *Daemon) DistributionServices() images.DistributionServices
DistributionServices returns services controlling daemon storage
func (*Daemon) ExecExists ¶
ExecExists looks up the exec instance and returns a bool if it exists or not. It will also return the error produced by `getConfig`
func (*Daemon) Exists ¶
Exists returns a true if a container of the specified ID or name exists, false otherwise.
func (*Daemon) FindNetwork ¶
func (daemon *Daemon) FindNetwork(term string) (libnetwork.Network, error)
FindNetwork returns a network based on: 1. Full ID 2. Full Name 3. Partial ID as long as there is no ambiguity
func (*Daemon) ForceEndpointDelete ¶
ForceEndpointDelete deletes an endpoint from a network forcefully
func (*Daemon) GetAttachmentStore ¶
func (daemon *Daemon) GetAttachmentStore() *network.AttachmentStore
GetAttachmentStore returns current attachment store associated with the daemon
func (*Daemon) GetCluster ¶
GetCluster returns the cluster
func (*Daemon) GetContainer ¶
GetContainer looks for a container using the provided information, which could be one of the following inputs from the caller:
- A full container ID, which will exact match a container in daemon's list
- A container name, which will only exact match via the GetByName() function
- A partial container ID prefix (e.g. short ID) of any length that is unique enough to only return a single container object If none of these searches succeed, an error is returned
func (*Daemon) GetContainerStats ¶
GetContainerStats collects all the stats published by a container
func (*Daemon) GetNetworkByID ¶
func (daemon *Daemon) GetNetworkByID(id string) (libnetwork.Network, error)
GetNetworkByID function returns a network whose ID matches the given ID. It fails with an error if no matching network is found.
func (*Daemon) GetNetworkByName ¶
func (daemon *Daemon) GetNetworkByName(name string) (libnetwork.Network, error)
GetNetworkByName function returns a network for a given network name. If no network name is given, the default network is returned.
func (*Daemon) GetNetworkDriverList ¶
GetNetworkDriverList returns the list of plugins drivers registered for network.
func (*Daemon) GetNetworks ¶
func (daemon *Daemon) GetNetworks(filter filters.Args, config types.NetworkListConfig) ([]types.NetworkResource, error)
GetNetworks returns a list of all networks
func (*Daemon) GetNetworksByIDPrefix ¶
func (daemon *Daemon) GetNetworksByIDPrefix(partialID string) []libnetwork.Network
GetNetworksByIDPrefix returns a list of networks whose ID partially matches zero or more networks
func (*Daemon) HasExperimental ¶
HasExperimental returns whether the experimental features of the daemon are enabled or not
func (*Daemon) IdentityMapping ¶
func (daemon *Daemon) IdentityMapping() *idtools.IdentityMapping
IdentityMapping returns uid/gid mapping or a SID (in the case of Windows) for the builder
func (*Daemon) ImageService ¶
func (daemon *Daemon) ImageService() *images.ImageService
ImageService returns the Daemon's ImageService
func (*Daemon) IsShuttingDown ¶
IsShuttingDown tells whether the daemon is shutting down or not
func (*Daemon) IsSwarmCompatible ¶
IsSwarmCompatible verifies if the current daemon configuration is compatible with the swarm mode
func (*Daemon) Kill ¶
func (daemon *Daemon) Kill(container *containerpkg.Container) error
Kill forcefully terminates a container.
func (*Daemon) List ¶
List returns an array of all containers registered in the daemon.
List: 返回在守护程序中注册的所有容器的数组.
func (*Daemon) LogContainerEvent ¶
LogContainerEvent generates an event related to a container with only the default attributes.
func (*Daemon) LogContainerEventWithAttributes ¶
func (daemon *Daemon) LogContainerEventWithAttributes(container *container.Container, action string, attributes map[string]string)
LogContainerEventWithAttributes generates an event related to a container with specific given attributes.
func (*Daemon) LogDaemonEventWithAttributes ¶
LogDaemonEventWithAttributes generates an event related to the daemon itself with specific given attributes.
func (*Daemon) LogNetworkEvent ¶
func (daemon *Daemon) LogNetworkEvent(nw libnetwork.Network, action string)
LogNetworkEvent generates an event related to a network with only the default attributes.
func (*Daemon) LogNetworkEventWithAttributes ¶
func (daemon *Daemon) LogNetworkEventWithAttributes(nw libnetwork.Network, action string, attributes map[string]string)
LogNetworkEventWithAttributes generates an event related to a network with specific given attributes.
func (*Daemon) LogPluginEvent ¶
LogPluginEvent generates an event related to a plugin with only the default attributes.
func (*Daemon) LogPluginEventWithAttributes ¶
func (daemon *Daemon) LogPluginEventWithAttributes(pluginID, refName, action string, attributes map[string]string)
LogPluginEventWithAttributes generates an event related to a plugin with specific given attributes.
func (*Daemon) LogVolumeEvent ¶
LogVolumeEvent generates an event related to a volume.
func (*Daemon) Mount ¶
Mount sets container.BaseFS (is it not set coming in? why is it unset?)
挂载设置 container.BaseFS (是否没有设置? 为什么不设置?)
func (*Daemon) NetworkController ¶
func (daemon *Daemon) NetworkController() libnetwork.NetworkController
NetworkController returns the network controller created by the daemon.
func (*Daemon) NetworkControllerEnabled ¶
NetworkControllerEnabled checks if the networking stack is enabled. This feature depends on OS primitives and it's disabled in systems like Windows.
func (*Daemon) NetworksPrune ¶
func (daemon *Daemon) NetworksPrune(ctx context.Context, pruneFilters filters.Args) (*types.NetworksPruneReport, error)
NetworksPrune removes unused networks
func (*Daemon) PluginGetter ¶
PluginGetter returns current pluginStore associated with the daemon
func (*Daemon) PluginManager ¶
PluginManager returns current pluginManager associated with the daemon
func (*Daemon) ProcessClusterNotifications ¶
func (daemon *Daemon) ProcessClusterNotifications(ctx context.Context, watchStream chan *swarmapi.WatchMessage)
ProcessClusterNotifications gets changes from store and add them to event list
func (*Daemon) ProcessEvent ¶
func (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei libcontainerdtypes.EventInfo) error
ProcessEvent is called by libcontainerd whenever an event occurs
func (*Daemon) RawSysInfo ¶
RawSysInfo returns *sysinfo.SysInfo .
func (*Daemon) RegistryHosts ¶
func (daemon *Daemon) RegistryHosts() docker.RegistryHosts
RegistryHosts returns registry configuration in containerd resolvers format
func (*Daemon) ReleaseIngress ¶
ReleaseIngress releases the ingress networking. The function returns a channel which will signal the caller when the programming is completed.
func (*Daemon) Reload ¶
Reload reads configuration changes and modifies the daemon according to those changes. These are the settings that Reload changes: - Platform runtime - Daemon debug log level - Daemon max concurrent downloads - Daemon max concurrent uploads - Daemon max download attempts - Daemon shutdown timeout (in seconds) - Cluster discovery (reconfigure and restart) - Daemon labels - Insecure registries - Registry mirrors - Daemon live restore
func (*Daemon) RestartSwarmContainers ¶
func (daemon *Daemon) RestartSwarmContainers()
RestartSwarmContainers restarts any autostart container which has a swarm endpoint.
RestartSwarmContainers: 重新启动所有具有swarm端点的自动启动容器.
func (*Daemon) SetCluster ¶
SetCluster sets the cluster
func (*Daemon) SetContainerConfigReferences ¶
func (daemon *Daemon) SetContainerConfigReferences(name string, refs []*swarmtypes.ConfigReference) error
SetContainerConfigReferences sets the container config references needed
func (*Daemon) SetContainerDependencyStore ¶
func (daemon *Daemon) SetContainerDependencyStore(name string, store exec.DependencyGetter) error
SetContainerDependencyStore sets the dependency store backend for the container
func (*Daemon) SetContainerSecretReferences ¶
func (daemon *Daemon) SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error
SetContainerSecretReferences sets the container secret references needed
func (*Daemon) SetNetworkBootstrapKeys ¶
func (daemon *Daemon) SetNetworkBootstrapKeys(keys []*networktypes.EncryptionKey) error
SetNetworkBootstrapKeys sets the bootstrap keys.
func (*Daemon) SetupIngress ¶
func (daemon *Daemon) SetupIngress(create clustertypes.NetworkCreateRequest, nodeIP string) (<-chan struct{}, error)
SetupIngress setups ingress networking. The function returns a channel which will signal the caller when the programming is completed.
func (*Daemon) ShutdownTimeout ¶
ShutdownTimeout returns the timeout (in seconds) before containers are forcibly killed during shutdown. The default timeout can be configured both on the daemon and per container, and the longest timeout will be used. A grace-period of 5 seconds is added to the configured timeout.
A negative (-1) timeout means "indefinitely", which means that containers are not forcibly killed, and the daemon shuts down after all containers exit.
func (*Daemon) StoreHosts ¶
StoreHosts stores the addresses the daemon is listening on
func (*Daemon) Subnets ¶
Subnets return the IPv4 and IPv6 subnets of networks that are manager by Docker.
func (*Daemon) SubscribeToEvents ¶
func (daemon *Daemon) SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan interface{})
SubscribeToEvents returns the currently record of events, a channel to stream new events from, and a function to cancel the stream of events.
func (*Daemon) SystemDiskUsage ¶
SystemDiskUsage returns information about the daemon data disk usage
func (*Daemon) SystemInfo ¶
SystemInfo returns information about the host server the daemon is running on.
func (*Daemon) SystemVersion ¶
SystemVersion returns version information about the daemon.
func (*Daemon) UnsubscribeFromEvents ¶
func (daemon *Daemon) UnsubscribeFromEvents(listener chan interface{})
UnsubscribeFromEvents stops the event subscription for a client by closing the channel where the daemon sends events to.
func (*Daemon) UpdateAttachment ¶
func (daemon *Daemon) UpdateAttachment(networkName, networkID, containerID string, config *network.NetworkingConfig) error
UpdateAttachment notifies the attacher about the attachment config.
func (*Daemon) UpdateContainerServiceConfig ¶
func (daemon *Daemon) UpdateContainerServiceConfig(containerName string, serviceConfig *clustertypes.ServiceConfig) error
UpdateContainerServiceConfig updates a service configuration.
func (*Daemon) VolumesService ¶
func (daemon *Daemon) VolumesService() *service.VolumesService
VolumesService is used to perform volume operations
type NetworkManager ¶
type NetworkManager interface { GetNetwork(input string) (apitypes.NetworkResource, error) GetNetworks(filters.Args) ([]apitypes.NetworkResource, error) RemoveNetwork(input string) error }
NetworkManager provides methods to manage networks
type PredefinedNetworkError ¶
type PredefinedNetworkError string
PredefinedNetworkError is returned when user tries to create predefined network that already exists.
func (PredefinedNetworkError) Error ¶
func (pnr PredefinedNetworkError) Error() string
func (PredefinedNetworkError) Forbidden ¶
func (pnr PredefinedNetworkError) Forbidden()
Forbidden denotes the type of this error
Source Files ¶
- apparmor_default.go
- archive.go
- archive_tarcopyoptions.go
- archive_tarcopyoptions_unix.go
- archive_unix.go
- attach.go
- auth.go
- changes.go
- checkpoint.go
- cluster.go
- commit.go
- configs.go
- configs_linux.go
- container.go
- container_linux.go
- container_operations.go
- container_operations_unix.go
- create.go
- create_unix.go
- daemon.go
- daemon_linux.go
- daemon_unix.go
- debugtrap_unix.go
- delete.go
- dependency.go
- devices_linux.go
- disk_usage.go
- errors.go
- events.go
- exec.go
- exec_linux.go
- export.go
- health.go
- info.go
- info_unix.go
- inspect.go
- inspect_linux.go
- keys.go
- kill.go
- licensing.go
- links.go
- list.go
- list_unix.go
- logdrivers_linux.go
- logs.go
- metrics.go
- metrics_unix.go
- monitor.go
- mounts.go
- names.go
- network.go
- nvidia_linux.go
- oci_linux.go
- oci_utils.go
- pause.go
- prune.go
- reload.go
- reload_unix.go
- rename.go
- resize.go
- restart.go
- seccomp_disabled.go
- secrets.go
- secrets_linux.go
- selinux_linux.go
- start.go
- start_unix.go
- stats.go
- stats_collector.go
- stats_unix.go
- stop.go
- top_unix.go
- trustkey.go
- unpause.go
- update.go
- update_linux.go
- volumes.go
- volumes_linux.go
- volumes_unix.go
- wait.go
- workdir.go
Directories ¶
Path | Synopsis |
---|---|
Package logger defines interfaces that logger drivers implement to log messages.
|
Package logger defines interfaces that logger drivers implement to log messages. |
awslogs
Package awslogs provides the logdriver for forwarding container logs to Amazon CloudWatch Logs
|
Package awslogs provides the logdriver for forwarding container logs to Amazon CloudWatch Logs |
etwlogs
Package etwlogs provides a log driver for forwarding container logs as ETW events.(ETW stands for Event Tracing for Windows) A client can then create an ETW listener to listen for events that are sent by the ETW provider that we register, using the provider's GUID "a3693192-9ed6-46d2-a981-f8226c8363bd".
|
Package etwlogs provides a log driver for forwarding container logs as ETW events.(ETW stands for Event Tracing for Windows) A client can then create an ETW listener to listen for events that are sent by the ETW provider that we register, using the provider's GUID "a3693192-9ed6-46d2-a981-f8226c8363bd". |
fluentd
Package fluentd provides the log driver for forwarding server logs to fluentd endpoints.
|
Package fluentd provides the log driver for forwarding server logs to fluentd endpoints. |
gelf
Package gelf provides the log driver for forwarding server logs to endpoints that support the Graylog Extended Log Format.
|
Package gelf provides the log driver for forwarding server logs to endpoints that support the Graylog Extended Log Format. |
journald
Package journald provides the log driver for forwarding server logs to endpoints that receive the systemd format.
|
Package journald provides the log driver for forwarding server logs to endpoints that receive the systemd format. |
jsonfilelog
Package jsonfilelog provides the default Logger implementation for Docker logging.
|
Package jsonfilelog provides the default Logger implementation for Docker logging. |
local
Package local provides a logger implementation that stores logs on disk.
|
Package local provides a logger implementation that stores logs on disk. |
logentries
Package logentries provides the log driver for forwarding server logs to logentries endpoints.
|
Package logentries provides the log driver for forwarding server logs to logentries endpoints. |
splunk
Package splunk provides the log driver for forwarding server logs to Splunk HTTP Event Collector endpoint.
|
Package splunk provides the log driver for forwarding server logs to Splunk HTTP Event Collector endpoint. |
syslog
Package syslog provides the logdriver for forwarding server logs to syslog endpoints.
|
Package syslog provides the logdriver for forwarding server logs to syslog endpoints. |