hypercli: github.com/hyperhq/hypercli/daemon Index | Files | Directories

package daemon

import "github.com/hyperhq/hypercli/daemon"

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.


Package Files

archive.go archive_unix.go attach.go changes.go commit.go config.go config_stub.go config_unix.go container_operations.go container_operations_unix.go create.go create_unix.go daemon.go daemon_linux.go daemon_stub.go daemon_unix.go debugtrap_unix.go delete.go discovery.go errors.go events.go exec.go exec_unix.go export.go image_delete.go images.go import.go info.go inspect.go inspect_unix.go kill.go links.go list.go list_unix.go logdrivers_linux.go logs.go mounts.go network.go pause.go rename.go resize.go restart.go selinux_linux.go start.go stats.go stats_collector_unix.go stats_linux.go stop.go top_unix.go unpause.go update.go volumes.go volumes_unix.go wait.go


const (
    // NetworkByID represents a constant to find a network by its ID
    NetworkByID = iota + 1
    // NetworkByName represents a constant to find a network by its Name


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")

func ReloadConfiguration Uses

func ReloadConfiguration(configFile string, flags *flag.FlagSet, reload func(*Config))

ReloadConfiguration reads the configuration in the host and reloads the daemon and server.

type CommonConfig Uses

type CommonConfig struct {
    AuthorizationPlugins []string            `json:"authorization-plugins,omitempty"` // AuthorizationPlugins holds list of authorization plugins
    AutoRestart          bool                `json:"-"`
    Context              map[string][]string `json:"-"`
    DisableBridge        bool                `json:"-"`
    DNS                  []string            `json:"dns,omitempty"`
    DNSOptions           []string            `json:"dns-opts,omitempty"`
    DNSSearch            []string            `json:"dns-search,omitempty"`
    ExecOptions          []string            `json:"exec-opts,omitempty"`
    ExecRoot             string              `json:"exec-root,omitempty"`
    GraphDriver          string              `json:"storage-driver,omitempty"`
    GraphOptions         []string            `json:"storage-opts,omitempty"`
    Labels               []string            `json:"labels,omitempty"`
    Mtu                  int                 `json:"mtu,omitempty"`
    Pidfile              string              `json:"pidfile,omitempty"`
    RawLogs              bool                `json:"raw-logs,omitempty"`
    Root                 string              `json:"graph,omitempty"`
    SocketGroup          string              `json:"group,omitempty"`
    TrustKeyPath         string              `json:"-"`

    // ClusterStore is the storage backend used for the cluster information. It is used by both
    // multihost networking (to store networks and endpoints information) and by the node discovery
    // mechanism.
    ClusterStore string `json:"cluster-store,omitempty"`

    // ClusterOpts is used to pass options to the discovery package for tuning libkv settings, such
    // as TLS configuration settings.
    ClusterOpts map[string]string `json:"cluster-store-opts,omitempty"`

    // ClusterAdvertise is the network endpoint that the Engine advertises for the purpose of node
    // discovery. This should be a 'host:port' combination on which that daemon instance is
    // reachable by other hosts.
    ClusterAdvertise string `json:"cluster-advertise,omitempty"`

    Debug     bool     `json:"debug,omitempty"`
    Hosts     []string `json:"hosts,omitempty"`
    LogLevel  string   `json:"log-level,omitempty"`
    TLS       bool     `json:"tls,omitempty"`
    TLSVerify bool     `json:"tlsverify,omitempty"`

    // Embedded structs that allow config
    // deserialization without the full struct.
    // contains filtered or unexported fields

CommonConfig defines the configuration of a docker daemon which are common across platforms. It includes json tags to deserialize configuration from a file using the same names that the flags in the command line uses.

type CommonTLSOptions Uses

type CommonTLSOptions struct {
    CAFile   string `json:"tlscacert,omitempty"`
    CertFile string `json:"tlscert,omitempty"`
    KeyFile  string `json:"tlskey,omitempty"`

CommonTLSOptions defines TLS configuration for the daemon server. It includes json tags to deserialize configuration from a file using the same names that the flags in the command line uses.

type Config Uses

type Config struct {

    CorsHeaders          string                   `json:"api-cors-headers,omitempty"`
    EnableCors           bool                     `json:"api-enable-cors,omitempty"`
    EnableSelinuxSupport bool                     `json:"selinux-enabled,omitempty"`
    RemappedRoot         string                   `json:"userns-remap,omitempty"`
    CgroupParent         string                   `json:"cgroup-parent,omitempty"`
    Ulimits              map[string]*units.Ulimit `json:"default-ulimits,omitempty"`

Config defines the configuration of a docker daemon. It includes json tags to deserialize configuration from a file using the same names that the flags in the command line uses.

func MergeDaemonConfigurations Uses

func MergeDaemonConfigurations(flagsConfig *Config, flags *flag.FlagSet, configFile string) (*Config, error)

MergeDaemonConfigurations reads a configuration file, loads the file configuration in an isolated structure, and merges the configuration provided from flags on top if there are no conflicts.

func (*Config) InstallCommonFlags Uses

func (config *Config) InstallCommonFlags(cmd *flag.FlagSet, usageFn func(string) string)

InstallCommonFlags adds command-line options to the top-level flag parser for the current process. Subsequent calls to `flag.Parse` will populate config with values parsed from the command-line.

func (*Config) InstallFlags Uses

func (config *Config) InstallFlags(cmd *flag.FlagSet, usageFn func(string) string)

InstallFlags adds command-line options to the top-level flag parser for the current process. Subsequent calls to `flag.Parse` will populate config with values parsed from the command-line.

func (*Config) IsValueSet Uses

func (config *Config) IsValueSet(name string) bool

IsValueSet returns true if a configuration value was explicitly set in the configuration file.

type ContainerAttachWithLogsConfig Uses

type ContainerAttachWithLogsConfig struct {
    Hijacker   http.Hijacker
    Upgrade    bool
    UseStdin   bool
    UseStdout  bool
    UseStderr  bool
    Logs       bool
    Stream     bool
    DetachKeys []byte

ContainerAttachWithLogsConfig holds the streams to use when connecting to a container to view logs.

type ContainerLogsConfig Uses

type ContainerLogsConfig struct {
    // if true stream log output
    Follow bool
    // if true include timestamps for each line of log output
    Timestamps bool
    // return that many lines of log output from the end
    Tail string
    // filter logs by returning on those entries after this time
    Since time.Time
    // whether or not to show stdout and stderr as well as log entries.
    UseStdout, UseStderr bool
    OutStream            io.Writer
    Stop                 <-chan bool

ContainerLogsConfig holds configs for logging operations. Exists for users of the daemon to to pass it a logging configuration.

type ContainerStatsConfig Uses

type ContainerStatsConfig struct {
    Stream    bool
    OutStream io.Writer
    Stop      <-chan bool
    Version   version.Version

ContainerStatsConfig holds information for configuring the runtime behavior of a daemon.ContainerStats() call.

type ContainerWsAttachWithLogsConfig Uses

type ContainerWsAttachWithLogsConfig struct {
    InStream             io.ReadCloser
    OutStream, ErrStream io.Writer
    Logs, Stream         bool
    DetachKeys           []byte

ContainerWsAttachWithLogsConfig attach with websockets, since all stream data is delegated to the websocket to handle there.

type ContainersConfig Uses

type ContainersConfig struct {
    // if true show all containers, otherwise only running containers.
    All bool
    // show all containers created after this container id
    Since string
    // show all containers created before this container id
    Before string
    // number of containers to return at most
    Limit int
    // if true include the sizes of the containers
    Size bool
    // return only containers that match filters
    Filters string

ContainersConfig is the filtering specified by the user to iterate over containers.

type Daemon Uses

type Daemon struct {
    ID  string

    RegistryService *registry.Service
    EventsService   *events.Events
    // contains filtered or unexported fields

Daemon holds information about the Docker daemon.

func NewDaemon Uses

func NewDaemon(config *Config, registryService *registry.Service) (daemon *Daemon, err error)

NewDaemon sets up everything for the daemon to be able to service requests from the webserver.

func (*Daemon) AuthenticateToRegistry Uses

func (daemon *Daemon) AuthenticateToRegistry(authConfig *types.AuthConfig) (string, error)

AuthenticateToRegistry checks the validity of credentials in authConfig

func (*Daemon) Cleanup Uses

func (daemon *Daemon) Cleanup(container *container.Container)

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) Commit Uses

func (daemon *Daemon) Commit(name string, c *types.ContainerCommitConfig) (string, error)

Commit creates a new filesystem image from the current state of a container. The image can optionally be tagged into a repository.

func (*Daemon) ConnectContainerToNetwork Uses

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 Uses

func (daemon *Daemon) ConnectToNetwork(container *container.Container, idOrName string, endpointConfig *networktypes.EndpointSettings) error

ConnectToNetwork connects a container to a network

func (*Daemon) ContainerArchivePath Uses

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) ContainerAttachOnBuild Uses

func (daemon *Daemon) ContainerAttachOnBuild(cID string, stdin io.ReadCloser, stdout, stderr io.Writer, stream bool) error

ContainerAttachOnBuild attaches streams to the container cID. If stream is true, it streams the output.

func (*Daemon) ContainerAttachWithLogs Uses

func (daemon *Daemon) ContainerAttachWithLogs(prefixOrName string, c *ContainerAttachWithLogsConfig) error

ContainerAttachWithLogs attaches to logs according to the config passed in. See ContainerAttachWithLogsConfig.

func (*Daemon) ContainerChanges Uses

func (daemon *Daemon) ContainerChanges(name string) ([]archive.Change, error)

ContainerChanges returns a list of container fs changes

func (*Daemon) ContainerCopy Uses

func (daemon *Daemon) ContainerCopy(name string, res string) (io.ReadCloser, error)

ContainerCopy performs a deprecated operation of archiving the resource at the specified path in the container identified by the given name.

func (*Daemon) ContainerCreate Uses

func (daemon *Daemon) ContainerCreate(params types.ContainerCreateConfig) (types.ContainerCreateResponse, error)

ContainerCreate creates a container.

func (*Daemon) ContainerExecCreate Uses

func (d *Daemon) ContainerExecCreate(config *types.ExecConfig) (string, error)

ContainerExecCreate sets up an exec in a running container.

func (*Daemon) ContainerExecInspect Uses

func (daemon *Daemon) ContainerExecInspect(id string) (*exec.Config, error)

ContainerExecInspect returns low-level information about the exec command. An error is returned if the exec cannot be found.

func (*Daemon) ContainerExecResize Uses

func (daemon *Daemon) ContainerExecResize(name string, height, width int) error

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 Uses

func (d *Daemon) ContainerExecStart(name string, stdin io.ReadCloser, stdout io.Writer, stderr io.Writer) error

ContainerExecStart starts a previously set up exec instance. The std streams are set up.

func (*Daemon) ContainerExport Uses

func (daemon *Daemon) ContainerExport(name string, out io.Writer) error

ContainerExport writes the contents of the container to the given writer. An error is returned if the container cannot be found.

func (*Daemon) ContainerExtractToDir Uses

func (daemon *Daemon) ContainerExtractToDir(name, path string, 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 Uses

func (daemon *Daemon) ContainerInspect(name string, size bool, version version.Version) (interface{}, error)

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) ContainerKill Uses

func (daemon *Daemon) ContainerKill(name string, sig uint64) error

ContainerKill send 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 Uses

func (daemon *Daemon) ContainerLogs(containerName string, config *ContainerLogsConfig) error

ContainerLogs hooks up a container's stdout and stderr streams configured with the given struct.

func (*Daemon) ContainerPause Uses

func (daemon *Daemon) ContainerPause(name string) error

ContainerPause pauses a container

func (*Daemon) ContainerRename Uses

func (daemon *Daemon) ContainerRename(oldName, newName string) error

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 Uses

func (daemon *Daemon) ContainerResize(name string, height, width int) error

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 Uses

func (daemon *Daemon) ContainerRestart(name string, seconds int) error

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 Uses

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 Uses

func (daemon *Daemon) ContainerStart(name string, hostConfig *containertypes.HostConfig) error

ContainerStart starts a container.

func (*Daemon) ContainerStatPath Uses

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 Uses

func (daemon *Daemon) ContainerStats(prefixOrName string, config *ContainerStatsConfig) error

ContainerStats writes information about the container to the stream given in the config object.

func (*Daemon) ContainerStop Uses

func (daemon *Daemon) ContainerStop(name string, seconds int) error

ContainerStop looks for the given container and terminates it, waiting the given number of seconds before forcefully killing the container. If a negative number of seconds is given, ContainerStop will wait for a graceful termination. An error is returned if the container is not found, is already stopped, or if there is a problem stopping the container.

func (*Daemon) ContainerTop Uses

func (daemon *Daemon) ContainerTop(name string, psArgs string) (*types.ContainerProcessList, 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 Uses

func (daemon *Daemon) ContainerUnpause(name string) error

ContainerUnpause unpauses a container

func (*Daemon) ContainerUpdate Uses

func (daemon *Daemon) ContainerUpdate(name string, hostConfig *container.HostConfig) ([]string, error)

ContainerUpdate updates resources of the container

func (*Daemon) ContainerUpdateCmdOnBuild Uses

func (daemon *Daemon) ContainerUpdateCmdOnBuild(cID string, cmd []string) error

ContainerUpdateCmdOnBuild updates Path and Args for the container with ID cID.

func (*Daemon) ContainerWait Uses

func (daemon *Daemon) ContainerWait(name string, timeout time.Duration) (int, error)

ContainerWait stops processing until the given container is stopped. If the container is not found, an error is returned. On a successful stop, the exit code of the container is returned. On a timeout, an error is returned. If you want to wait forever, supply a negative duration for the timeout.

func (*Daemon) ContainerWsAttachWithLogs Uses

func (daemon *Daemon) ContainerWsAttachWithLogs(prefixOrName string, c *ContainerWsAttachWithLogsConfig) error

ContainerWsAttachWithLogs websocket connection

func (*Daemon) Containers Uses

func (daemon *Daemon) Containers(config *ContainersConfig) ([]*types.Container, error)

Containers returns the list of containers to show given the user's filtering.

func (*Daemon) CopyOnBuild Uses

func (daemon *Daemon) CopyOnBuild(cID string, destPath string, src builder.FileInfo, decompress bool) error

CopyOnBuild copies/extracts a source FileInfo to a destination path inside a container specified by a container object. TODO: make sure callers don't unnecessarily convert destPath with filepath.FromSlash (Copy does it already). CopyOnBuild should take in abstract paths (with slashes) and the implementation should convert it to OS-specific paths.

func (*Daemon) CreateNetwork Uses

func (daemon *Daemon) CreateNetwork(name, driver string, ipam network.IPAM, options map[string]string, internal bool) (libnetwork.Network, error)

CreateNetwork creates a network with the given name, driver and other optional parameters

func (*Daemon) DeleteNetwork Uses

func (daemon *Daemon) DeleteNetwork(networkID string) error

DeleteNetwork destroys a network unless it's one of docker's predefined networks.

func (*Daemon) DisconnectContainerFromNetwork Uses

func (daemon *Daemon) DisconnectContainerFromNetwork(containerName string, network libnetwork.Network, force bool) error

DisconnectContainerFromNetwork disconnects the given container from the given network. If either cannot be found, an err is returned.

func (*Daemon) DisconnectFromNetwork Uses

func (daemon *Daemon) DisconnectFromNetwork(container *container.Container, n libnetwork.Network, force bool) error

DisconnectFromNetwork disconnects container from network n.

func (*Daemon) Exec Uses

func (d *Daemon) Exec(c *container.Container, execConfig *exec.Config, pipes *execdriver.Pipes, startCallback execdriver.DriverCallback) (int, error)

Exec calls the underlying exec driver to run

func (*Daemon) ExecExists Uses

func (d *Daemon) ExecExists(name string) (bool, error)

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) ExecutionDriver Uses

func (daemon *Daemon) ExecutionDriver() execdriver.Driver

ExecutionDriver returns the currently used driver for creating and starting execs in a container.

func (*Daemon) Exists Uses

func (daemon *Daemon) Exists(id string) bool

Exists returns a true if a container of the specified ID or name exists, false otherwise.

func (*Daemon) ExportImage Uses

func (daemon *Daemon) ExportImage(names []string, outStream io.Writer) error

ExportImage exports a list of images to the given output stream. The exported images are archived into a tar when written to the output stream. All images with the given tag and all versions containing the same tag are exported. names is the set of tags to export, and outStream is the writer which the images are written to.

func (*Daemon) FindNetwork Uses

func (daemon *Daemon) FindNetwork(idName string) (libnetwork.Network, error)

FindNetwork function finds a network for a given string that can represent network name or id

func (*Daemon) ForceEndpointDelete Uses

func (daemon *Daemon) ForceEndpointDelete(name string, n libnetwork.Network) error

ForceEndpointDelete deletes an endpoing from a network forcefully

func (*Daemon) GetAllNetworks Uses

func (daemon *Daemon) GetAllNetworks() []libnetwork.Network

GetAllNetworks returns a list containing all networks

func (*Daemon) GetByName Uses

func (daemon *Daemon) GetByName(name string) (*container.Container, error)

GetByName returns a container given a name.

func (*Daemon) GetCachedImage Uses

func (daemon *Daemon) GetCachedImage(imgID image.ID, config *containertypes.Config) (*image.Image, error)

GetCachedImage returns the most recent created image that is a child of the image with imgID, that had the same config when it was created. nil is returned if a child cannot be found. An error is returned if the parent image cannot be found.

func (*Daemon) GetCachedImageOnBuild Uses

func (daemon *Daemon) GetCachedImageOnBuild(imgID string, cfg *containertypes.Config) (string, error)

GetCachedImageOnBuild returns a reference to a cached image whose parent equals `parent` and runconfig equals `cfg`. A cache miss is expected to return an empty ID and a nil error.

func (*Daemon) GetContainer Uses

func (daemon *Daemon) GetContainer(prefixOrName string) (*container.Container, error)

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 Uses

func (daemon *Daemon) GetContainerStats(container *container.Container) (*execdriver.ResourceStats, error)

GetContainerStats collects all the stats published by a container

func (*Daemon) GetImage Uses

func (daemon *Daemon) GetImage(refOrID string) (*image.Image, error)

GetImage returns an image corresponding to the image referred to by refOrID.

func (*Daemon) GetImageID Uses

func (daemon *Daemon) GetImageID(refOrID string) (image.ID, error)

GetImageID returns an image ID corresponding to the image referred to by refOrID.

func (*Daemon) GetImageOnBuild Uses

func (daemon *Daemon) GetImageOnBuild(name string) (builder.Image, error)

GetImageOnBuild looks up a Docker image referenced by `name`.

func (*Daemon) GetLabels Uses

func (daemon *Daemon) GetLabels(id string) map[string]string

GetLabels for a container or image id

func (*Daemon) GetNetwork Uses

func (daemon *Daemon) GetNetwork(idName string, by int) (libnetwork.Network, error)

GetNetwork function returns a network for a given string that represents the network and a hint to indicate if the string is an Id or Name of the network

func (*Daemon) GetNetworkDriverList Uses

func (daemon *Daemon) GetNetworkDriverList() map[string]bool

GetNetworkDriverList returns the list of plugins drivers registered for network.

func (*Daemon) GetNetworksByID Uses

func (daemon *Daemon) GetNetworksByID(partialID string) []libnetwork.Network

GetNetworksByID returns a list of networks whose ID partially matches zero or more networks

func (*Daemon) GetRemappedUIDGID Uses

func (daemon *Daemon) GetRemappedUIDGID() (int, int)

GetRemappedUIDGID returns the current daemon's uid and gid values if user namespaces are in use for this daemon instance. If not this function will return "real" root values of 0, 0.

func (*Daemon) GetUIDGIDMaps Uses

func (daemon *Daemon) GetUIDGIDMaps() ([]idtools.IDMap, []idtools.IDMap)

GetUIDGIDMaps returns the current daemon's user namespace settings for the full uid and gid maps which will be applied to containers started in this instance.

func (*Daemon) GraphDriverName Uses

func (daemon *Daemon) GraphDriverName() string

GraphDriverName returns the name of the graph driver used by the layer.Store

func (*Daemon) ImageDelete Uses

func (daemon *Daemon) ImageDelete(imageRef string, force, prune bool) ([]types.ImageDelete, error)

ImageDelete deletes the image referenced by the given imageRef from this daemon. The given imageRef can be an image ID, ID prefix, or a repository reference (with an optional tag or digest, defaulting to the tag name "latest"). There is differing behavior depending on whether the given imageRef is a repository reference or not.

If the given imageRef is a repository reference then that repository reference will be removed. However, if there exists any containers which were created using the same image reference then the repository reference cannot be removed unless either there are other repository references to the same image or force is true. Following removal of the repository reference, the referenced image itself will attempt to be deleted as described below but quietly, meaning any image delete conflicts will cause the image to not be deleted and the conflict will not be reported.

There may be conflicts preventing deletion of an image and these conflicts are divided into two categories grouped by their severity:

Hard Conflict:

- a pull or build using the image.
- any descendent image.
- any running container using the image.

Soft Conflict:

- any stopped container using the image.
- any repository tag or digest references to the image.

The image cannot be removed if there are any hard conflicts and can be removed if there are soft conflicts only if force is true.

If prune is true, ancestor images will each attempt to be deleted quietly, meaning any delete conflicts will cause the image to not be deleted and the conflict will not be reported.

FIXME: remove ImageDelete's dependency on Daemon, then move to the graph package. This would require that we no longer need the daemon to determine whether images are being used by a stopped or running container.

func (*Daemon) ImageHistory Uses

func (daemon *Daemon) ImageHistory(name string) ([]*types.ImageHistory, error)

ImageHistory returns a slice of ImageHistory structures for the specified image name by walking the image lineage.

func (*Daemon) Images Uses

func (daemon *Daemon) Images(filterArgs, filter string, all bool) ([]*types.Image, error)

Images returns a filtered list of images. filterArgs is a JSON-encoded set of filter arguments which will be interpreted by api/types/filters. filter is a shell glob string applied to repository names. The argument named all controls whether all images in the graph are filtered, or just the heads.

func (*Daemon) ImportImage Uses

func (daemon *Daemon) ImportImage(src string, newRef reference.Named, msg string, inConfig io.ReadCloser, outStream io.Writer, config *container.Config) error

ImportImage imports an image, getting the archived layer data either from inConfig (if src is "-"), or from a URI specified in src. Progress output is written to outStream. Repository and tag names can optionally be given in the repo and tag arguments, respectively.

func (*Daemon) IsPaused Uses

func (daemon *Daemon) IsPaused(id string) bool

IsPaused returns a bool indicating if the specified container is paused.

func (*Daemon) IsShuttingDown Uses

func (daemon *Daemon) IsShuttingDown() bool

IsShuttingDown tells whether the daemon is shutting down or not

func (*Daemon) Kill Uses

func (daemon *Daemon) Kill(container *container.Container) error

Kill forcefully terminates a container.

func (*Daemon) List Uses

func (daemon *Daemon) List() []*container.Container

List returns an array of all containers registered in the daemon.

func (*Daemon) LoadImage Uses

func (daemon *Daemon) LoadImage(inTar io.ReadCloser, outStream io.Writer) error

LoadImage uploads a set of images into the repository. This is the complement of ImageExport. The input stream is an uncompressed tar ball containing images and metadata.

func (*Daemon) LogContainerEvent Uses

func (daemon *Daemon) LogContainerEvent(container *container.Container, action string)

LogContainerEvent generates an event related to a container with only the default attributes.

func (*Daemon) LogContainerEventWithAttributes Uses

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) LogImageEvent Uses

func (daemon *Daemon) LogImageEvent(imageID, refName, action string)

LogImageEvent generates an event related to a container with only the default attributes.

func (*Daemon) LogImageEventWithAttributes Uses

func (daemon *Daemon) LogImageEventWithAttributes(imageID, refName, action string, attributes map[string]string)

LogImageEventWithAttributes generates an event related to a container with specific given attributes.

func (*Daemon) LogNetworkEvent Uses

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 Uses

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) LogVolumeEvent Uses

func (daemon *Daemon) LogVolumeEvent(volumeID, action string, attributes map[string]string)

LogVolumeEvent generates an event related to a volume.

func (*Daemon) LookupImage Uses

func (daemon *Daemon) LookupImage(name string) (*types.ImageInspect, error)

LookupImage looks up an image by name and returns it as an ImageInspect structure.

func (*Daemon) Map Uses

func (daemon *Daemon) Map() map[image.ID]*image.Image

Map returns a map of all images in the ImageStore

func (*Daemon) Mount Uses

func (daemon *Daemon) Mount(container *container.Container) error

Mount sets container.BaseFS (is it not set coming in? why is it unset?)

func (*Daemon) NetworkControllerEnabled Uses

func (daemon *Daemon) NetworkControllerEnabled() bool

NetworkControllerEnabled checks if the networking stack is enabled. This feature depends on OS primitives and it's disabled in systems like Windows.

func (*Daemon) PullImage Uses

func (daemon *Daemon) PullImage(ref reference.Named, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error

PullImage initiates a pull operation. image is the repository name to pull, and tag may be either empty, or indicate a specific tag to pull.

func (*Daemon) PullOnBuild Uses

func (daemon *Daemon) PullOnBuild(name string, authConfigs map[string]types.AuthConfig, output io.Writer) (builder.Image, error)

PullOnBuild tells Docker to pull image referenced by `name`.

func (*Daemon) PushImage Uses

func (daemon *Daemon) PushImage(ref reference.Named, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error

PushImage initiates a push operation on the repository named localName.

func (*Daemon) Register Uses

func (daemon *Daemon) Register(container *container.Container) error

Register makes a container object usable by the daemon as <container.ID>

func (*Daemon) Reload Uses

func (daemon *Daemon) Reload(config *Config) error

Reload reads configuration changes and modifies the daemon according to those changes. This are the settings that Reload changes: - Daemon labels.

func (*Daemon) Run Uses

func (daemon *Daemon) Run(c *container.Container, pipes *execdriver.Pipes, startCallback execdriver.DriverCallback) (execdriver.ExitStatus, error)

Run uses the execution driver to run a given container

func (*Daemon) SearchRegistryForImages Uses

func (daemon *Daemon) SearchRegistryForImages(term string,
    authConfig *types.AuthConfig,
    headers map[string][]string) (*registrytypes.SearchResults, error)

SearchRegistryForImages queries the registry for images matching term. authConfig is used to login.

func (*Daemon) Shutdown Uses

func (daemon *Daemon) Shutdown() error

Shutdown stops the daemon.

func (*Daemon) Start Uses

func (daemon *Daemon) Start(container *container.Container) error

Start starts a container

func (*Daemon) StartLogging Uses

func (daemon *Daemon) StartLogging(container *container.Container) error

StartLogging initializes and starts the container logging stream.

func (*Daemon) SubscribeToEvents Uses

func (daemon *Daemon) SubscribeToEvents(since, sinceNano int64, filter filters.Args) ([]eventtypes.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) SystemInfo Uses

func (daemon *Daemon) SystemInfo() (*types.Info, error)

SystemInfo returns information about the host server the daemon is running on.

func (*Daemon) SystemVersion Uses

func (daemon *Daemon) SystemVersion() types.Version

SystemVersion returns version information about the daemon.

func (*Daemon) TagImage Uses

func (daemon *Daemon) TagImage(newTag reference.Named, imageName string) error

TagImage creates the tag specified by newTag, pointing to the image named imageName (alternatively, imageName can also be an image ID).

func (*Daemon) Unmount Uses

func (daemon *Daemon) Unmount(container *container.Container)

Unmount unsets the container base filesystem

func (*Daemon) UnsubscribeFromEvents Uses

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) VolumeCreate Uses

func (daemon *Daemon) VolumeCreate(name, driverName string, opts map[string]string) (*types.Volume, error)

VolumeCreate creates a volume with the specified name, driver, and opts This is called directly from the remote API

func (*Daemon) VolumeInspect Uses

func (daemon *Daemon) VolumeInspect(name string) (*types.Volume, error)

VolumeInspect looks up a volume by name. An error is returned if the volume cannot be found.

func (*Daemon) VolumeRm Uses

func (daemon *Daemon) VolumeRm(name string) error

VolumeRm removes the volume with the given name. If the volume is referenced by a container it is not removed This is called directly from the remote API

func (*Daemon) Volumes Uses

func (daemon *Daemon) Volumes(filter string) ([]*types.Volume, []string, error)

Volumes lists known volumes, using the filter to restrict the range of volumes returned.

type ErrImageDoesNotExist Uses

type ErrImageDoesNotExist struct {
    RefOrID string

ErrImageDoesNotExist is error returned when no image can be found for a reference.

func (ErrImageDoesNotExist) Error Uses

func (e ErrImageDoesNotExist) Error() string

type LogConfig Uses

type LogConfig struct {
    Type   string            `json:"log-driver,omitempty"`
    Config map[string]string `json:"log-opts,omitempty"`

LogConfig represents the default log configuration. It includes json tags to deserialize configuration from a file using the same names that the flags in the command line uses.


loggerPackage logger defines interfaces that logger drivers implement to log messages.
logger/awslogsPackage awslogs provides the logdriver for forwarding container logs to Amazon CloudWatch Logs
logger/fluentdPackage fluentd provides the log driver for forwarding server logs to fluentd endpoints.
logger/gelfPackage gelf provides the log driver for forwarding server logs to endpoints that support the Graylog Extended Log Format.
logger/journaldPackage journald provides the log driver for forwarding server logs to endpoints that receive the systemd format.
logger/jsonfilelogPackage jsonfilelog provides the default Logger implementation for Docker logging.
logger/splunkPackage splunk provides the log driver for forwarding server logs to Splunk HTTP Event Collector endpoint.
logger/syslogPackage syslog provides the logdriver for forwarding server logs to syslog endpoints.

Package daemon imports 124 packages (graph) and is imported by 16 packages. Updated 2017-11-26. Refresh now. Tools for package owners.