{"modulePath":"github.com/study-core/docker","version":"v0.0.0-20200710064335-ca4a307c3199","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package daemon\n\nPackage daemon exposes the functions that occur on the host server that the Docker daemon is running.\n\nIn implementing the various functions of the daemon, there is often a method-specific struct for configuring the runtime behavior.\n\n## Constants\n\n```go\nconst (\n\n\t// DefaultShimBinary is the default shim to be used by containerd if none\n\t// is specified\n\tDefaultShimBinary = \"containerd-shim\"\n\n\t// DefaultRuntimeBinary is the default runtime to be used by\n\t// containerd if none is specified\n\tDefaultRuntimeBinary = \"runc\"\n\n\t// DefaultRuntimeName is the default runtime to be used by\n\t// containerd if none is specified\n\tDefaultRuntimeName = \"runc\"\n)\n```\n\n```go\nconst (\n\tContainersNamespace = \"moby\"\n)\n```\nContainersNamespace is the name of the namespace used for users containers\n\n## Variables\n\n```go\nvar ErrExtractPointNotDirectory = errors.New(\"extraction point is not a directory\")\n```\nErrExtractPointNotDirectory 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.\n\n```go\nvar (\n\t// ErrRootFSReadOnly is returned when a container\n\t// rootfs is marked readonly.\n\tErrRootFSReadOnly = errors.New(\"container rootfs is marked read-only\")\n)\n```\n\n```go\nvar (\n\t// ErrVolumeReadonly is used to signal an error when trying to copy data into\n\t// a volume mount that is not writable.\n\tErrVolumeReadonly = errors.New(\"mounted volume is marked read-only\")\n)\n```\n\n## Functions\n\n```go\nfunc CreateDaemonRoot(config *config.Config) error\n```\nCreateDaemonRoot creates the root for the daemon\n\n创建守护程序根目录 (root目录)\n\n```go\nfunc IsRunningSystemd() bool\n```\nIsRunningSystemd is from [https://github.com/opencontainers/runc/blob/46be7b612e2533c494e6a251111de46d8e286ed5/libcontainer/cgroups/systemd/common.go#L27-L33](https://github.com/opencontainers/runc/blob/46be7b612e2533c494e6a251111de46d8e286ed5/libcontainer/cgroups/systemd/common.go#L27-L33)\n\n```go\nfunc ModifyRootKeyLimit() error\n```\nModifyRootKeyLimit 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.\n\n```go\nfunc UsingSystemd(config *config.Config) bool\n```\nUsingSystemd returns true if cli option includes native.cgroupdriver=systemd\n\n```go\nfunc VerifyCgroupDriver(config *config.Config) error\n```\nVerifyCgroupDriver validates native.cgroupdriver\n\n```go\nfunc WithApparmor(c *container.Container) coci.SpecOpts\n```\nWithApparmor sets the apparmor profile\n\n```go\nfunc WithCapabilities(c *container.Container) coci.SpecOpts\n```\nWithCapabilities sets the container's capabilties\n\n```go\nfunc WithCgroups(daemon *Daemon, c *container.Container) coci.SpecOpts\n```\nWithCgroups sets the container's cgroups\n\n```go\nfunc WithCommonOptions(daemon *Daemon, c *container.Container) coci.SpecOpts\n```\nWithCommonOptions sets common docker options\n\n```go\nfunc WithDevices(daemon *Daemon, c *container.Container) coci.SpecOpts\n```\nWithDevices sets the container's devices\n\n```go\nfunc WithLibnetwork(daemon *Daemon, c *container.Container) coci.SpecOpts\n```\nWithLibnetwork sets the libnetwork hook\n\n```go\nfunc WithMounts(daemon *Daemon, c *container.Container) coci.SpecOpts\n```\nWithMounts sets the container's mounts\n\n```go\nfunc WithNamespaces(daemon *Daemon, c *container.Container) coci.SpecOpts\n```\nWithNamespaces sets the container's namespaces\n\n```go\nfunc WithOOMScore(score *int) coci.SpecOpts\n```\nWithOOMScore sets the oom score\n\n```go\nfunc WithResources(c *container.Container) coci.SpecOpts\n```\nWithResources applies the container resources\n\n```go\nfunc WithRlimits(daemon *Daemon, c *container.Container) coci.SpecOpts\n```\nWithRlimits sets the container's rlimits along with merging the daemon's rlimits\n\n```go\nfunc WithRootless(daemon *Daemon) coci.SpecOpts\n```\nWithRootless sets the spec to the rootless configuration\n\n```go\nfunc WithSeccomp(daemon *Daemon, c *container.Container) coci.SpecOpts\n```\nWithSeccomp sets the seccomp profile\n\n```go\nfunc WithSelinux(c *container.Container) coci.SpecOpts\n```\nWithSelinux sets the selinux labels\n\n```go\nfunc WithSysctls(c *container.Container) coci.SpecOpts\n```\nWithSysctls sets the container's sysctls\n\n```go\nfunc WithUser(c *container.Container) coci.SpecOpts\n```\nWithUser sets the container's user\n\n## Types\n\n```go\ntype Cluster interface {\n\tClusterStatus\n\tNetworkManager\n\tSendClusterEvent(event lncluster.ConfigEventType)\n}\n```\nCluster is the interface for github.com/docker/docker/daemon/cluster.(\\*Cluster).\n\n```go\ntype ClusterStatus interface {\n\tIsAgent() bool\n\tIsManager() bool\n}\n```\nClusterStatus interface provides information about the Swarm status of the Cluster\n\n```go\ntype Daemon struct {\n\tID string\n\n\tRegistryService registry.Service\n\tEventsService   *events.Events\n\n\tPluginStore *plugin.Store // todo: remove\n\t// contains filtered or unexported fields\n}\n```\nDaemon holds information about the Docker daemon.\n\n```go\nfunc NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.Store) (daemon *Daemon, err error)\n```\nNewDaemon sets up everything for the daemon to be able to service requests from the webserver.\n\n```go\nfunc (daemon *Daemon) ActivateContainerServiceBinding(containerName string) error\n```\nActivateContainerServiceBinding puts this container into load balancer active rotation and DNS response\n\n```go\nfunc (daemon *Daemon) AuthenticateToRegistry(ctx context.Context, authConfig *types.AuthConfig) (string, string, error)\n```\nAuthenticateToRegistry checks the validity of credentials in authConfig\n\n```go\nfunc (daemon *Daemon) BuilderBackend() builder.Backend\n```\nBuilderBackend returns the backend used by builder\n\n```go\nfunc (daemon *Daemon) CheckpointCreate(name string, config types.CheckpointCreateOptions) error\n```\nCheckpointCreate checkpoints the process running in a container with CRIU\n\n```go\nfunc (daemon *Daemon) CheckpointDelete(name string, config types.CheckpointDeleteOptions) error\n```\nCheckpointDelete deletes the specified checkpoint\n\n```go\nfunc (daemon *Daemon) CheckpointList(name string, config types.CheckpointListOptions) ([]types.Checkpoint, error)\n```\nCheckpointList lists all checkpoints of the specified container\n\n```go\nfunc (daemon *Daemon) Cleanup(container *container.Container)\n```\nCleanup 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.\n\n```go\nfunc (daemon *Daemon) ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error\n```\nConnectContainerToNetwork 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.\n\n```go\nfunc (daemon *Daemon) ConnectToNetwork(container *container.Container, idOrName string, endpointConfig *networktypes.EndpointSettings) error\n```\nConnectToNetwork connects a container to a network\n\n```go\nfunc (daemon *Daemon) ContainerArchivePath(name string, path string) (content io.ReadCloser, stat *types.ContainerPathStat, err error)\n```\nContainerArchivePath 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.\n\n```go\nfunc (daemon *Daemon) ContainerAttach(prefixOrName string, c *backend.ContainerAttachConfig) error\n```\nContainerAttach attaches to logs according to the config passed in. See ContainerAttachConfig.\n\n```go\nfunc (daemon *Daemon) ContainerAttachRaw(prefixOrName string, stdin io.ReadCloser, stdout, stderr io.Writer, doStream bool, attached chan struct{}) error\n```\nContainerAttachRaw attaches the provided streams to the container's stdio\n\n```go\nfunc (daemon *Daemon) ContainerChanges(name string) ([]archive.Change, error)\n```\nContainerChanges returns a list of container fs changes\n\n```go\nfunc (daemon *Daemon) ContainerCopy(name string, res string) (io.ReadCloser, error)\n```\nContainerCopy performs a deprecated operation of archiving the resource at the specified path in the container identified by the given name.\n\n```go\nfunc (daemon *Daemon) ContainerCreate(params types.ContainerCreateConfig) (containertypes.ContainerCreateCreatedBody, error)\n```\nContainerCreate creates a regular container\n\n```go\nfunc (daemon *Daemon) ContainerCreateIgnoreImagesArgsEscaped(params types.ContainerCreateConfig) (containertypes.ContainerCreateCreatedBody, error)\n```\nContainerCreateIgnoreImagesArgsEscaped creates a regular container. This is called from the builder RUN case and ensures that we do not take the images ArgsEscaped\n\n```go\nfunc (daemon *Daemon) ContainerCreateWorkdir(cID string) error\n```\nContainerCreateWorkdir creates the working directory. This solves the issue arising from [https://github.com/docker/docker/issues/27545](https://github.com/docker/docker/issues/27545), which was initially fixed by [https://github.com/docker/docker/pull/27884](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](https://github.com/docker/docker/pull/28514) introduces this new functionality where the builder calls into the backend here to create the working directory.\n\n```go\nfunc (daemon *Daemon) ContainerExecCreate(name string, config *types.ExecConfig) (string, error)\n```\nContainerExecCreate sets up an exec in a running container.\n\n```go\nfunc (daemon *Daemon) ContainerExecInspect(id string) (*backend.ExecInspect, error)\n```\nContainerExecInspect returns low-level information about the exec command. An error is returned if the exec cannot be found.\n\n```go\nfunc (daemon *Daemon) ContainerExecResize(name string, height, width int) error\n```\nContainerExecResize changes the size of the TTY of the process running in the exec with the given name to the given height and width.\n\n```go\nfunc (daemon *Daemon) ContainerExecStart(ctx context.Context, name string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (err error)\n```\nContainerExecStart starts a previously set up exec instance. The std streams are set up. If ctx is cancelled, the process is terminated.\n\n```go\nfunc (daemon *Daemon) ContainerExport(name string, out io.Writer) error\n```\nContainerExport writes the contents of the container to the given writer. An error is returned if the container cannot be found.\n\n```go\nfunc (daemon *Daemon) ContainerExtractToDir(name, path string, copyUIDGID, noOverwriteDirNonDir bool, content io.Reader) error\n```\nContainerExtractToDir 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.\n\n```go\nfunc (daemon *Daemon) ContainerInspect(name string, size bool, version string) (interface{}, error)\n```\nContainerInspect 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.\n\n```go\nfunc (daemon *Daemon) ContainerInspectCurrent(name string, size bool) (*types.ContainerJSON, error)\n```\nContainerInspectCurrent returns low-level information about a container in a most recent api version.\n\n```go\nfunc (daemon *Daemon) ContainerKill(name string, sig uint64) error\n```\nContainerKill 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.\n\n```go\nfunc (daemon *Daemon) ContainerLogs(ctx context.Context, containerName string, config *types.ContainerLogsOptions) (messages \u003c-chan *backend.LogMessage, isTTY bool, retErr error)\n```\nContainerLogs 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.\n\nif it returns nil, the config channel will be active and return log messages until it runs out or the context is canceled.\n\n```go\nfunc (daemon *Daemon) ContainerPause(name string) error\n```\nContainerPause pauses a container\n\n```go\nfunc (daemon *Daemon) ContainerRename(oldName, newName string) error\n```\nContainerRename changes the name of a container, using the oldName to find the container. An error is returned if newName is already reserved.\n\n```go\nfunc (daemon *Daemon) ContainerResize(name string, height, width int) error\n```\nContainerResize changes the size of the TTY of the process running in the container with the given name to the given height and width.\n\n```go\nfunc (daemon *Daemon) ContainerRestart(name string, seconds *int) error\n```\nContainerRestart 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.\n\n```go\nfunc (daemon *Daemon) ContainerRm(name string, config *types.ContainerRmConfig) error\n```\nContainerRm 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.\n\n```go\nfunc (daemon *Daemon) ContainerStart(name string, hostConfig *containertypes.HostConfig, checkpoint string, checkpointDir string) error\n```\nContainerStart starts a container.\n\n```go\nfunc (daemon *Daemon) ContainerStatPath(name string, path string) (stat *types.ContainerPathStat, err error)\n```\nContainerStatPath stats the filesystem resource at the specified path in the container identified by the given name.\n\n```go\nfunc (daemon *Daemon) ContainerStats(ctx context.Context, prefixOrName string, config *backend.ContainerStatsConfig) error\n```\nContainerStats writes information about the container to the stream given in the config object.\n\n```go\nfunc (daemon *Daemon) ContainerStop(name string, timeout *int) error\n```\nContainerStop 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).\n\nIf 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.\n\n```go\nfunc (daemon *Daemon) ContainerTop(name string, psArgs string) (*container.ContainerTopOKBody, error)\n```\nContainerTop 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.\n\n```go\nfunc (daemon *Daemon) ContainerUnpause(name string) error\n```\nContainerUnpause unpauses a container\n\n```go\nfunc (daemon *Daemon) ContainerUpdate(name string, hostConfig *container.HostConfig) (container.ContainerUpdateOKBody, error)\n```\nContainerUpdate updates configuration of the container\n\n```go\nfunc (daemon *Daemon) ContainerWait(ctx context.Context, name string, condition container.WaitCondition) (\u003c-chan container.StateStatus, error)\n```\nContainerWait 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.\n\n```go\nfunc (daemon *Daemon) Containers(config *types.ContainerListOptions) ([]*types.Container, error)\n```\nContainers returns the list of containers to show given the user's filtering.\n\n```go\nfunc (daemon *Daemon) ContainersPrune(ctx context.Context, pruneFilters filters.Args) (*types.ContainersPruneReport, error)\n```\nContainersPrune removes unused containers\n\n```go\nfunc (daemon *Daemon) CreateImageFromContainer(name string, c *backend.CreateImageConfig) (string, error)\n```\nCreateImageFromContainer 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.\n\n```go\nfunc (daemon *Daemon) CreateManagedContainer(params types.ContainerCreateConfig) (containertypes.ContainerCreateCreatedBody, error)\n```\nCreateManagedContainer creates a container that is managed by a Service\n\n```go\nfunc (daemon *Daemon) CreateManagedNetwork(create clustertypes.NetworkCreateRequest) error\n```\nCreateManagedNetwork creates an agent network.\n\n```go\nfunc (daemon *Daemon) CreateNetwork(create types.NetworkCreateRequest) (*types.NetworkCreateResponse, error)\n```\nCreateNetwork creates a network with the given name, driver and other optional parameters\n\n```go\nfunc (daemon *Daemon) DaemonJoinsCluster(clusterProvider cluster.Provider)\n```\nDaemonJoinsCluster informs the daemon has joined the cluster and provides the handler to query the cluster component\n\n```go\nfunc (daemon *Daemon) DaemonLeavesCluster()\n```\nDaemonLeavesCluster informs the daemon has left the cluster\n\n```go\nfunc (daemon *Daemon) DeactivateContainerServiceBinding(containerName string) error\n```\nDeactivateContainerServiceBinding removes this container from load balancer active rotation, and DNS response\n\n```go\nfunc (daemon *Daemon) DeleteManagedNetwork(networkID string) error\n```\nDeleteManagedNetwork deletes an agent network. The requirement of networkID is enforced.\n\n```go\nfunc (daemon *Daemon) DeleteNetwork(networkID string) error\n```\nDeleteNetwork destroys a network unless it's one of docker's predefined networks.\n\n```go\nfunc (daemon *Daemon) DisconnectContainerFromNetwork(containerName string, networkName string, force bool) error\n```\nDisconnectContainerFromNetwork disconnects the given container from the given network. If either cannot be found, an err is returned.\n\n```go\nfunc (daemon *Daemon) DisconnectFromNetwork(container *container.Container, networkName string, force bool) error\n```\nDisconnectFromNetwork disconnects container from network n.\n\n```go\nfunc (daemon *Daemon) DistributionServices() images.DistributionServices\n```\nDistributionServices returns services controlling daemon storage\n\n```go\nfunc (daemon *Daemon) ExecExists(name string) (bool, error)\n```\nExecExists looks up the exec instance and returns a bool if it exists or not. It will also return the error produced by \\`getConfig\\`\n\n```go\nfunc (daemon *Daemon) Exists(id string) bool\n```\nExists returns a true if a container of the specified ID or name exists, false otherwise.\n\n```go\nfunc (daemon *Daemon) Features() *map[string]bool\n```\nFeatures returns the features map from configStore\n\n```go\nfunc (daemon *Daemon) FindNetwork(term string) (libnetwork.Network, error)\n```\nFindNetwork returns a network based on: 1. Full ID 2. Full Name 3. Partial ID as long as there is no ambiguity\n\n```go\nfunc (daemon *Daemon) ForceEndpointDelete(name string, networkName string) error\n```\nForceEndpointDelete deletes an endpoint from a network forcefully\n\n```go\nfunc (daemon *Daemon) GetAttachmentStore() *network.AttachmentStore\n```\nGetAttachmentStore returns current attachment store associated with the daemon\n\n```go\nfunc (daemon *Daemon) GetByName(name string) (*container.Container, error)\n```\nGetByName returns a container given a name.\n\n```go\nfunc (daemon *Daemon) GetCluster() Cluster\n```\nGetCluster returns the cluster\n\n```go\nfunc (daemon *Daemon) GetContainer(prefixOrName string) (*container.Container, error)\n```\nGetContainer looks for a container using the provided information, which could be one of the following inputs from the caller:\n\n  - A full container ID, which will exact match a container in daemon's list\n  - A container name, which will only exact match via the GetByName() function\n  - 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\n\n```go\nfunc (daemon *Daemon) GetContainerStats(container *container.Container) (*types.StatsJSON, error)\n```\nGetContainerStats collects all the stats published by a container\n\n```go\nfunc (daemon *Daemon) GetNetworkByID(id string) (libnetwork.Network, error)\n```\nGetNetworkByID function returns a network whose ID matches the given ID. It fails with an error if no matching network is found.\n\n```go\nfunc (daemon *Daemon) GetNetworkByName(name string) (libnetwork.Network, error)\n```\nGetNetworkByName function returns a network for a given network name. If no network name is given, the default network is returned.\n\n```go\nfunc (daemon *Daemon) GetNetworkDriverList() []string\n```\nGetNetworkDriverList returns the list of plugins drivers registered for network.\n\n```go\nfunc (daemon *Daemon) GetNetworks(filter filters.Args, config types.NetworkListConfig) ([]types.NetworkResource, error)\n```\nGetNetworks returns a list of all networks\n\n```go\nfunc (daemon *Daemon) GetNetworksByIDPrefix(partialID string) []libnetwork.Network\n```\nGetNetworksByIDPrefix returns a list of networks whose ID partially matches zero or more networks\n\n```go\nfunc (daemon *Daemon) HasExperimental() bool\n```\nHasExperimental returns whether the experimental features of the daemon are enabled or not\n\n```go\nfunc (daemon *Daemon) IdentityMapping() *idtools.IdentityMapping\n```\nIdentityMapping returns uid/gid mapping or a SID (in the case of Windows) for the builder\n\n```go\nfunc (daemon *Daemon) ImageService() *images.ImageService\n```\nImageService returns the Daemon's ImageService\n\n```go\nfunc (daemon *Daemon) IsPaused(id string) bool\n```\nIsPaused returns a bool indicating if the specified container is paused.\n\n```go\nfunc (daemon *Daemon) IsShuttingDown() bool\n```\nIsShuttingDown tells whether the daemon is shutting down or not\n\n```go\nfunc (daemon *Daemon) IsSwarmCompatible() error\n```\nIsSwarmCompatible verifies if the current daemon configuration is compatible with the swarm mode\n\n```go\nfunc (daemon *Daemon) Kill(container *containerpkg.Container) error\n```\nKill forcefully terminates a container.\n\n```go\nfunc (daemon *Daemon) List() []*container.Container\n```\nList returns an array of all containers registered in the daemon.\n\nList: 返回在守护程序中注册的所有容器的数组.\n\n```go\nfunc (daemon *Daemon) LogContainerEvent(container *container.Container, action string)\n```\nLogContainerEvent generates an event related to a container with only the default attributes.\n\n```go\nfunc (daemon *Daemon) LogContainerEventWithAttributes(container *container.Container, action string, attributes map[string]string)\n```\nLogContainerEventWithAttributes generates an event related to a container with specific given attributes.\n\n```go\nfunc (daemon *Daemon) LogDaemonEventWithAttributes(action string, attributes map[string]string)\n```\nLogDaemonEventWithAttributes generates an event related to the daemon itself with specific given attributes.\n\n```go\nfunc (daemon *Daemon) LogNetworkEvent(nw libnetwork.Network, action string)\n```\nLogNetworkEvent generates an event related to a network with only the default attributes.\n\n```go\nfunc (daemon *Daemon) LogNetworkEventWithAttributes(nw libnetwork.Network, action string, attributes map[string]string)\n```\nLogNetworkEventWithAttributes generates an event related to a network with specific given attributes.\n\n```go\nfunc (daemon *Daemon) LogPluginEvent(pluginID, refName, action string)\n```\nLogPluginEvent generates an event related to a plugin with only the default attributes.\n\n```go\nfunc (daemon *Daemon) LogPluginEventWithAttributes(pluginID, refName, action string, attributes map[string]string)\n```\nLogPluginEventWithAttributes generates an event related to a plugin with specific given attributes.\n\n```go\nfunc (daemon *Daemon) LogVolumeEvent(volumeID, action string, attributes map[string]string)\n```\nLogVolumeEvent generates an event related to a volume.\n\n```go\nfunc (daemon *Daemon) Mount(container *container.Container) error\n```\nMount sets container.BaseFS (is it not set coming in? why is it unset?)\n\n挂载设置 container.BaseFS (是否没有设置? 为什么不设置?)\n\n```go\nfunc (daemon *Daemon) NetworkController() libnetwork.NetworkController\n```\nNetworkController returns the network controller created by the daemon.\n\n```go\nfunc (daemon *Daemon) NetworkControllerEnabled() bool\n```\nNetworkControllerEnabled checks if the networking stack is enabled. This feature depends on OS primitives and it's disabled in systems like Windows.\n\n```go\nfunc (daemon *Daemon) NetworksPrune(ctx context.Context, pruneFilters filters.Args) (*types.NetworksPruneReport, error)\n```\nNetworksPrune removes unused networks\n\n```go\nfunc (daemon *Daemon) PluginGetter() *plugin.Store\n```\nPluginGetter returns current pluginStore associated with the daemon\n\n```go\nfunc (daemon *Daemon) PluginManager() *plugin.Manager\n```\nPluginManager returns current pluginManager associated with the daemon\n\n```go\nfunc (daemon *Daemon) ProcessClusterNotifications(ctx context.Context, watchStream chan *swarmapi.WatchMessage)\n```\nProcessClusterNotifications gets changes from store and add them to event list\n\n```go\nfunc (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei libcontainerdtypes.EventInfo) error\n```\nProcessEvent is called by libcontainerd whenever an event occurs\n\n```go\nfunc (daemon *Daemon) RawSysInfo(quiet bool) *sysinfo.SysInfo\n```\nRawSysInfo returns \\*sysinfo.SysInfo .\n\n```go\nfunc (daemon *Daemon) Register(c *container.Container) error\n```\nRegister makes a container object usable by the daemon as \\\u003ccontainer.ID\u003e\n\n```go\nfunc (daemon *Daemon) RegistryHosts() docker.RegistryHosts\n```\nRegistryHosts returns registry configuration in containerd resolvers format\n\n```go\nfunc (daemon *Daemon) ReleaseIngress() (\u003c-chan struct{}, error)\n```\nReleaseIngress releases the ingress networking. The function returns a channel which will signal the caller when the programming is completed.\n\n```go\nfunc (daemon *Daemon) Reload(conf *config.Config) (err error)\n```\nReload 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\n\n```go\nfunc (daemon *Daemon) RestartSwarmContainers()\n```\nRestartSwarmContainers restarts any autostart container which has a swarm endpoint.\n\nRestartSwarmContainers: 重新启动所有具有swarm端点的自动启动容器.\n\n```go\nfunc (daemon *Daemon) Rootless() bool\n```\nRootless returns true if daemon is running in rootless mode\n\n```go\nfunc (daemon *Daemon) SetCluster(cluster Cluster)\n```\nSetCluster sets the cluster\n\n```go\nfunc (daemon *Daemon) SetContainerConfigReferences(name string, refs []*swarmtypes.ConfigReference) error\n```\nSetContainerConfigReferences sets the container config references needed\n\n```go\nfunc (daemon *Daemon) SetContainerDependencyStore(name string, store exec.DependencyGetter) error\n```\nSetContainerDependencyStore sets the dependency store backend for the container\n\n```go\nfunc (daemon *Daemon) SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error\n```\nSetContainerSecretReferences sets the container secret references needed\n\n```go\nfunc (daemon *Daemon) SetNetworkBootstrapKeys(keys []*networktypes.EncryptionKey) error\n```\nSetNetworkBootstrapKeys sets the bootstrap keys.\n\n```go\nfunc (daemon *Daemon) SetupIngress(create clustertypes.NetworkCreateRequest, nodeIP string) (\u003c-chan struct{}, error)\n```\nSetupIngress setups ingress networking. The function returns a channel which will signal the caller when the programming is completed.\n\n```go\nfunc (daemon *Daemon) Shutdown() error\n```\nShutdown stops the daemon.\n\n```go\nfunc (daemon *Daemon) ShutdownTimeout() int\n```\nShutdownTimeout 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.\n\nA negative (-1) timeout means \"indefinitely\", which means that containers are not forcibly killed, and the daemon shuts down after all containers exit.\n\n```go\nfunc (daemon *Daemon) StoreHosts(hosts []string)\n```\nStoreHosts stores the addresses the daemon is listening on\n\n```go\nfunc (daemon *Daemon) Subnets() ([]net.IPNet, []net.IPNet)\n```\nSubnets return the IPv4 and IPv6 subnets of networks that are manager by Docker.\n\n```go\nfunc (daemon *Daemon) SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan interface{})\n```\nSubscribeToEvents returns the currently record of events, a channel to stream new events from, and a function to cancel the stream of events.\n\n```go\nfunc (daemon *Daemon) SystemDiskUsage(ctx context.Context) (*types.DiskUsage, error)\n```\nSystemDiskUsage returns information about the daemon data disk usage\n\n```go\nfunc (daemon *Daemon) SystemInfo() *types.Info\n```\nSystemInfo returns information about the host server the daemon is running on.\n\n```go\nfunc (daemon *Daemon) SystemVersion() types.Version\n```\nSystemVersion returns version information about the daemon.\n\n```go\nfunc (daemon *Daemon) Unmount(container *container.Container) error\n```\nUnmount unsets the container base filesystem\n\n```go\nfunc (daemon *Daemon) UnsubscribeFromEvents(listener chan interface{})\n```\nUnsubscribeFromEvents stops the event subscription for a client by closing the channel where the daemon sends events to.\n\n```go\nfunc (daemon *Daemon) UpdateAttachment(networkName, networkID, containerID string, config *network.NetworkingConfig) error\n```\nUpdateAttachment notifies the attacher about the attachment config.\n\n```go\nfunc (daemon *Daemon) UpdateContainerServiceConfig(containerName string, serviceConfig *clustertypes.ServiceConfig) error\n```\nUpdateContainerServiceConfig updates a service configuration.\n\n```go\nfunc (daemon *Daemon) VolumesService() *service.VolumesService\n```\nVolumesService is used to perform volume operations\n\n```go\nfunc (daemon *Daemon) WaitForDetachment(ctx context.Context, networkName, networkID, taskID, containerID string) error\n```\nWaitForDetachment makes the cluster manager wait for detachment of the container from the network.\n\n```go\ntype NetworkManager interface {\n\tGetNetwork(input string) (apitypes.NetworkResource, error)\n\tGetNetworks(filters.Args) ([]apitypes.NetworkResource, error)\n\tRemoveNetwork(input string) error\n}\n```\nNetworkManager provides methods to manage networks\n\n```go\ntype PredefinedNetworkError string\n```\nPredefinedNetworkError is returned when user tries to create predefined network that already exists.\n\n```go\nfunc (pnr PredefinedNetworkError) Error() string\n```\n\n```go\nfunc (pnr PredefinedNetworkError) Forbidden()\n```\nForbidden denotes the type of this error\n\n","path":"github.com/study-core/docker/daemon","name":"daemon","synopsis":"Package daemon exposes the functions that occur on the host server that the Docker daemon is running.","isRedistributable":true}
