docker: Index | Files | Directories

package daemon

import ""


Package Files

attach.go changes.go commit.go config.go container.go copy.go create.go daemon.go daemon_aufs.go daemon_btrfs.go daemon_devicemapper.go daemon_overlay.go delete.go exec.go exec_linux.go export.go history.go image_delete.go info.go inspect.go kill.go list.go logs.go monitor.go pause.go rename.go resize.go restart.go start.go state.go stats.go stats_collector.go stop.go top.go unpause.go utils.go utils_linux.go volumes.go volumes_linux.go


const DefaultPathEnv = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"


var (
    ErrNotATTY               = errors.New("The PTY is not a file")
    ErrNoTTY                 = errors.New("No PTY found")
    ErrContainerStart        = errors.New("The container failed to start. Unknown error")
    ErrContainerStartTimeout = errors.New("The container failed to start due to timed out.")

func GetFullContainerName Uses

func GetFullContainerName(name string) (string, error)

type Config Uses

type Config struct {
    Bridge bridge.Config

    Pidfile              string
    Root                 string
    AutoRestart          bool
    Dns                  []string
    DnsSearch            []string
    GraphDriver          string
    GraphOptions         []string
    ExecDriver           string
    ExecOptions          []string
    Mtu                  int
    SocketGroup          string
    EnableCors           bool
    CorsHeaders          string
    DisableNetwork       bool
    EnableSelinuxSupport bool
    Context              map[string][]string
    TrustKeyPath         string
    Labels               []string
    Ulimits              map[string]*ulimit.Ulimit
    LogConfig            runconfig.LogConfig

Config define the configuration of a docker daemon These are the configuration settings that you pass to the docker daemon when you launch it with say: `docker -d -e lxc` FIXME: separate runtime configuration from http api configuration

func (*Config) InstallFlags Uses

func (config *Config) InstallFlags()

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.

type Container Uses

type Container struct {
    *State `json:"State"` // Needed for remote api version <= 1.11

    ID  string

    Created time.Time

    Path string
    Args []string

    Config  *runconfig.Config
    ImageID string `json:"Image"`

    NetworkSettings *network.Settings

    ResolvConfPath string
    HostnamePath   string
    HostsPath      string
    LogPath        string
    Name           string
    Driver         string
    ExecDriver     string


    MountLabel, ProcessLabel string
    AppArmorProfile          string
    RestartCount             int
    UpdateDns                bool

    // Maps container paths to volume paths.  The key in this is the path to which
    // the volume is being mounted inside the container.  Value is the path of the
    // volume on disk
    Volumes map[string]string
    // Store rw/ro in a separate structure to preserve reverse-compatibility on-disk.
    // Easier than migrating older container configs :)
    VolumesRW map[string]bool

    AppliedVolumesFrom map[string]struct{}
    // contains filtered or unexported fields

func (*Container) AllocateNetwork Uses

func (container *Container) AllocateNetwork() error

func (*Container) Attach Uses

func (c *Container) Attach(stdin io.ReadCloser, stdout io.Writer, stderr io.Writer) chan error

func (*Container) AttachWithLogs Uses

func (c *Container) AttachWithLogs(stdin io.ReadCloser, stdout, stderr io.Writer, logs, stream bool) error

func (*Container) Changes Uses

func (container *Container) Changes() ([]archive.Change, error)

func (*Container) Copy Uses

func (container *Container) Copy(resource string) (io.ReadCloser, error)
func (container *Container) DisableLink(name string)

func (*Container) Exec Uses

func (container *Container) Exec(execConfig *execConfig) error

func (*Container) Export Uses

func (container *Container) Export() (archive.Archive, error)

func (*Container) ExportRw Uses

func (container *Container) ExportRw() (archive.Archive, error)

func (*Container) Exposes Uses

func (container *Container) Exposes(p nat.Port) bool

Returns true if the container exposes a certain port

func (*Container) FromDisk Uses

func (container *Container) FromDisk() error

func (*Container) GetExecIDs Uses

func (container *Container) GetExecIDs() []string

func (*Container) GetImage Uses

func (container *Container) GetImage() (*image.Image, error)

func (*Container) GetMountLabel Uses

func (container *Container) GetMountLabel() string

func (*Container) GetProcessLabel Uses

func (container *Container) GetProcessLabel() string

func (*Container) GetResourcePath Uses

func (container *Container) GetResourcePath(path string) (string, error)

Evaluates `path` in the scope of the container's basefs, with proper path sanitisation. Symlinks are all scoped to the basefs of the container, as though the container's basefs was `/`.

The basefs of a container is the host-facing path which is bind-mounted as `/` inside the container. This method is essentially used to access a particular path inside the container as though you were a process in that container.

NOTE: The returned path is *only* safely scoped inside the container's basefs

if no component of the returned path changes (such as a component
symlinking to a different path) between using this method and using the
path. See symlink.FollowSymlinkInScope for more details.

func (*Container) GetRootResourcePath Uses

func (container *Container) GetRootResourcePath(path string) (string, error)

Evaluates `path` in the scope of the container's root, with proper path sanitisation. Symlinks are all scoped to the root of the container, as though the container's root was `/`.

The root of a container is the host-facing configuration metadata directory. Only use this method to safely access the container's `container.json` or other metadata files. If in doubt, use container.GetResourcePath.

NOTE: The returned path is *only* safely scoped inside the container's root

if no component of the returned path changes (such as a component
symlinking to a different path) between using this method and using the
path. See symlink.FollowSymlinkInScope for more details.

func (*Container) GetSize Uses

func (container *Container) GetSize() (int64, int64)

GetSize, return real size, virtual size

func (*Container) HostConfig Uses

func (container *Container) HostConfig() *runconfig.HostConfig

func (*Container) Kill Uses

func (container *Container) Kill() error

func (*Container) KillSig Uses

func (container *Container) KillSig(sig int) error

func (*Container) LogDriverType Uses

func (c *Container) LogDriverType() string

func (*Container) LogEvent Uses

func (container *Container) LogEvent(action string)

func (*Container) Mount Uses

func (container *Container) Mount() error

func (*Container) Output Uses

func (container *Container) Output() (output []byte, err error)

func (*Container) Pause Uses

func (container *Container) Pause() error

func (*Container) ReadLog Uses

func (container *Container) ReadLog(name string) (io.Reader, error)

func (*Container) ReleaseNetwork Uses

func (container *Container) ReleaseNetwork()

func (*Container) Resize Uses

func (container *Container) Resize(h, w int) error

func (*Container) Restart Uses

func (container *Container) Restart(seconds int) error

func (*Container) RestoreNetwork Uses

func (container *Container) RestoreNetwork() error

func (*Container) RootfsPath Uses

func (container *Container) RootfsPath() string

This method must be exported to be used from the lxc template This directory is only usable when the container is running

func (*Container) Run Uses

func (container *Container) Run() error

func (*Container) SetHostConfig Uses

func (container *Container) SetHostConfig(hostConfig *runconfig.HostConfig)

func (*Container) Start Uses

func (container *Container) Start() (err error)

func (*Container) Stats Uses

func (container *Container) Stats() (*execdriver.ResourceStats, error)

func (*Container) Stop Uses

func (container *Container) Stop(seconds int) error

func (*Container) ToDisk Uses

func (container *Container) ToDisk() error

func (*Container) Unmount Uses

func (container *Container) Unmount() error

func (*Container) Unpause Uses

func (container *Container) Unpause() error

func (*Container) VolumePaths Uses

func (container *Container) VolumePaths() map[string]struct{}

func (*Container) WriteHostConfig Uses

func (container *Container) WriteHostConfig() error

type ContainerCommitConfig Uses

type ContainerCommitConfig struct {
    Pause   bool
    Repo    string
    Tag     string
    Author  string
    Comment string
    Changes []string
    Config  *runconfig.Config

type ContainerJSONRaw Uses

type ContainerJSONRaw struct {
    HostConfig *runconfig.HostConfig

type ContainerLogsConfig Uses

type ContainerLogsConfig struct {
    Follow, Timestamps   bool
    Tail                 string
    UseStdout, UseStderr bool
    OutStream            io.Writer

type ContainerRmConfig Uses

type ContainerRmConfig struct {
    ForceRemove, RemoveVolume, RemoveLink bool

type ContainersConfig Uses

type ContainersConfig struct {
    All     bool
    Since   string
    Before  string
    Limit   int
    Size    bool
    Filters string

type Daemon Uses

type Daemon struct {
    ID  string

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

func NewDaemon Uses

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

func (*Daemon) Changes Uses

func (daemon *Daemon) Changes(container *Container) ([]archive.Change, error)

func (*Daemon) Children Uses

func (daemon *Daemon) Children(name string) (map[string]*Container, error)

func (*Daemon) Commit Uses

func (daemon *Daemon) Commit(container *Container, repository, tag, comment, author string, pause bool, config *runconfig.Config) (*image.Image, 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) Config Uses

func (daemon *Daemon) Config() *Config

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)

func (*Daemon) ContainerCreate Uses

func (daemon *Daemon) ContainerCreate(name string, config *runconfig.Config, hostConfig *runconfig.HostConfig) (string, []string, error)

func (*Daemon) ContainerExecCreate Uses

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

func (*Daemon) ContainerExecInspect Uses

func (daemon *Daemon) ContainerExecInspect(id string) (*execConfig, error)

func (*Daemon) ContainerExecResize Uses

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

func (*Daemon) ContainerExecStart Uses

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

func (*Daemon) ContainerExport Uses

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

func (*Daemon) ContainerGraph Uses

func (daemon *Daemon) ContainerGraph() *graphdb.Database

func (*Daemon) ContainerInspect Uses

func (daemon *Daemon) ContainerInspect(name string) (*types.ContainerJSON, error)

func (*Daemon) ContainerInspectRaw Uses

func (daemon *Daemon) ContainerInspectRaw(name string) (*ContainerJSONRaw, error)

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(name string, config *ContainerLogsConfig) error

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

func (*Daemon) ContainerResize Uses

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

func (*Daemon) ContainerRestart Uses

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

func (*Daemon) ContainerRm Uses

func (daemon *Daemon) ContainerRm(name string, config *ContainerRmConfig) error

func (*Daemon) ContainerStart Uses

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

func (*Daemon) ContainerStats Uses

func (daemon *Daemon) ContainerStats(name string, stream bool, out io.Writer) error

func (*Daemon) ContainerStop Uses

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

func (*Daemon) ContainerTop Uses

func (daemon *Daemon) ContainerTop(name string, psArgs string) (*types.ContainerProcessList, error)

func (*Daemon) ContainerUnpause Uses

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

ContainerUnpause unpauses a container

func (*Daemon) Containers Uses

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

func (*Daemon) Create Uses

func (daemon *Daemon) Create(config *runconfig.Config, hostConfig *runconfig.HostConfig, name string) (*Container, []string, error)

Create creates a new container from the given configuration with a given name.

func (*Daemon) DeleteVolumes Uses

func (daemon *Daemon) DeleteVolumes(volumeIDs map[string]struct{})

func (*Daemon) Diff Uses

func (daemon *Daemon) Diff(container *Container) (archive.Archive, error)

func (*Daemon) Exec Uses

func (d *Daemon) Exec(c *Container, execConfig *execConfig, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error)

func (*Daemon) ExecutionDriver Uses

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

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

func (daemon *Daemon) ForceRm(container *Container) (err error)

func (*Daemon) GenerateSecurityOpt Uses

func (daemon *Daemon) GenerateSecurityOpt(ipcMode runconfig.IpcMode, pidMode runconfig.PidMode) ([]string, error)

func (*Daemon) Get Uses

func (daemon *Daemon) Get(prefixOrName string) (*Container, error)

Get 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) GetByName Uses

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

func (*Daemon) Graph Uses

func (daemon *Daemon) Graph() *graph.Graph

FIXME: this is a convenience function for integration tests which need direct access to daemon.graph. Once the tests switch to using engine and jobs, this method can go away.

func (*Daemon) GraphDriver Uses

func (daemon *Daemon) GraphDriver() graphdriver.Driver

func (*Daemon) ImageDelete Uses

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

FIXME: remove ImageDelete's dependency on Daemon, then move to graph/

func (*Daemon) ImageGetCached Uses

func (daemon *Daemon) ImageGetCached(imgID string, config *runconfig.Config) (*image.Image, error)

func (*Daemon) Kill Uses

func (daemon *Daemon) Kill(c *Container, sig int) error

func (*Daemon) List Uses

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

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

func (*Daemon) Mount Uses

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

func (*Daemon) Parents Uses

func (daemon *Daemon) Parents(name string) ([]string, error)

func (*Daemon) Pause Uses

func (daemon *Daemon) Pause(c *Container) error

func (*Daemon) Register Uses

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

Register makes a container object usable by the daemon as <container.ID> This is a wrapper for register

func (daemon *Daemon) RegisterLink(parent, child *Container, alias string) error
func (daemon *Daemon) RegisterLinks(container *Container, hostConfig *runconfig.HostConfig) error

func (*Daemon) Repositories Uses

func (daemon *Daemon) Repositories() *graph.TagStore

func (*Daemon) Rm Uses

func (daemon *Daemon) Rm(container *Container) (err error)

func (*Daemon) Run Uses

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

func (*Daemon) Shutdown Uses

func (daemon *Daemon) Shutdown() error

func (*Daemon) Stats Uses

func (daemon *Daemon) Stats(c *Container) (*execdriver.ResourceStats, error)

func (*Daemon) SubscribeToContainerStats Uses

func (daemon *Daemon) SubscribeToContainerStats(name string) (chan interface{}, error)

func (*Daemon) SystemConfig Uses

func (daemon *Daemon) SystemConfig() *sysinfo.SysInfo

func (*Daemon) SystemInfo Uses

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

func (*Daemon) SystemInitPath Uses

func (daemon *Daemon) SystemInitPath() string

func (*Daemon) Unmount Uses

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

func (*Daemon) Unpause Uses

func (daemon *Daemon) Unpause(c *Container) error

func (*Daemon) UnsubscribeToContainerStats Uses

func (daemon *Daemon) UnsubscribeToContainerStats(name string, ch chan interface{}) error

type History Uses

type History []*Container

History is a convenience type for storing a list of containers, ordered by creation date.

func (*History) Add Uses

func (history *History) Add(container *Container)

func (*History) Len Uses

func (history *History) Len() int

func (*History) Less Uses

func (history *History) Less(i, j int) bool

func (*History) Sort Uses

func (history *History) Sort()

func (*History) Swap Uses

func (history *History) Swap(i, j int)

type State Uses

type State struct {
    Running    bool
    Paused     bool
    Restarting bool
    OOMKilled  bool

    Dead       bool
    Pid        int
    ExitCode   int
    Error      string // contains last known error when starting the container
    StartedAt  time.Time
    FinishedAt time.Time
    // contains filtered or unexported fields

func NewState Uses

func NewState() *State

func (*State) GetExitCode Uses

func (s *State) GetExitCode() int

func (*State) GetPid Uses

func (s *State) GetPid() int

func (*State) IsPaused Uses

func (s *State) IsPaused() bool

func (*State) IsRestarting Uses

func (s *State) IsRestarting() bool

func (*State) IsRunning Uses

func (s *State) IsRunning() bool

func (*State) ResetRemovalInProgress Uses

func (s *State) ResetRemovalInProgress()

func (*State) SetDead Uses

func (s *State) SetDead()

func (*State) SetPaused Uses

func (s *State) SetPaused()

func (*State) SetRemovalInProgress Uses

func (s *State) SetRemovalInProgress() error

func (*State) SetRestarting Uses

func (s *State) SetRestarting(exitStatus *execdriver.ExitStatus)

SetRestarting is when docker handles the auto restart of containers when they are in the middle of a stop and being restarted again

func (*State) SetRunning Uses

func (s *State) SetRunning(pid int)

func (*State) SetStopped Uses

func (s *State) SetStopped(exitStatus *execdriver.ExitStatus)

func (*State) SetUnpaused Uses

func (s *State) SetUnpaused()

func (*State) StateString Uses

func (s *State) StateString() string

StateString returns a single string to describe state

func (*State) String Uses

func (s *State) String() string

String returns a human-readable description of the state

func (*State) WaitRunning Uses

func (s *State) WaitRunning(timeout time.Duration) (int, error)

WaitRunning waits until state is running. If state already running it returns immediately. If you want wait forever you must supply negative timeout. Returns pid, that was passed to SetRunning

func (*State) WaitStop Uses

func (s *State) WaitStop(timeout time.Duration) (int, error)

WaitStop waits until state is stopped. If state already stopped it returns immediately. If you want wait forever you must supply negative timeout. Returns exit code, that was passed to SetStopped

type StreamConfig Uses

type StreamConfig struct {
    // contains filtered or unexported fields

func (*StreamConfig) StderrLogPipe Uses

func (streamConfig *StreamConfig) StderrLogPipe() io.ReadCloser

func (*StreamConfig) StderrPipe Uses

func (streamConfig *StreamConfig) StderrPipe() io.ReadCloser

func (*StreamConfig) StdinPipe Uses

func (streamConfig *StreamConfig) StdinPipe() io.WriteCloser

func (*StreamConfig) StdoutLogPipe Uses

func (streamConfig *StreamConfig) StdoutLogPipe() io.ReadCloser

func (*StreamConfig) StdoutPipe Uses

func (streamConfig *StreamConfig) StdoutPipe() io.ReadCloser



Package daemon imports 87 packages (graph). Updated 2016-11-11. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).