Documentation ¶
Index ¶
- Constants
- Variables
- func GetFullContainerName(name string) (string, error)
- type CommonConfig
- type CommonContainer
- type Config
- type Container
- func (container *Container) AllocateNetwork() error
- func (c *Container) Attach(stdin io.ReadCloser, stdout io.Writer, stderr io.Writer) chan error
- func (c *Container) AttachWithLogs(stdin io.ReadCloser, stdout, stderr io.Writer, logs, stream bool) error
- func (container *Container) Changes() ([]archive.Change, error)
- func (container *Container) Copy(resource string) (io.ReadCloser, error)
- func (container *Container) DisableLink(name string)
- func (container *Container) Exec(execConfig *execConfig) error
- func (container *Container) Export() (archive.Archive, error)
- func (container *Container) ExportRw() (archive.Archive, error)
- func (container *Container) Exposes(p nat.Port) bool
- func (container *Container) FromDisk() error
- func (container *Container) GetExecIDs() []string
- func (container *Container) GetImage() (*image.Image, error)
- func (container *Container) GetMountLabel() string
- func (container *Container) GetProcessLabel() string
- func (container *Container) GetResourcePath(path string) (string, error)
- func (container *Container) GetRootResourcePath(path string) (string, error)
- func (container *Container) GetSize() (int64, int64)
- func (container *Container) HostConfig() *runconfig.HostConfig
- func (container *Container) Kill() error
- func (container *Container) KillSig(sig int) error
- func (c *Container) LogDriverType() string
- func (container *Container) LogEvent(action string)
- func (container *Container) Mount() error
- func (container *Container) Output() (output []byte, err error)
- func (container *Container) Pause() error
- func (container *Container) ReleaseNetwork()
- func (container *Container) Resize(h, w int) error
- func (container *Container) Restart(seconds int) error
- func (container *Container) RootfsPath() string
- func (container *Container) Run() error
- func (container *Container) SetHostConfig(hostConfig *runconfig.HostConfig)
- func (container *Container) Start() (err error)
- func (container *Container) Stats() (*execdriver.ResourceStats, error)
- func (container *Container) Stop(seconds int) error
- func (container *Container) ToDisk() error
- func (container *Container) Unmount() error
- func (container *Container) UnmountVolumes(forceSyscall bool) error
- func (container *Container) Unpause() error
- func (container *Container) UpdateNetwork() error
- func (container *Container) WriteHostConfig() error
- type ContainerAttachWithLogsConfig
- type ContainerCommitConfig
- type ContainerJSONRaw
- type ContainerLogsConfig
- type ContainerRmConfig
- type ContainerWsAttachWithLogsConfig
- type ContainersConfig
- type Daemon
- func (daemon *Daemon) Changes(container *Container) ([]archive.Change, error)
- func (daemon *Daemon) Children(name string) (map[string]*Container, error)
- func (daemon *Daemon) Commit(container *Container, repository, tag, comment, author string, pause bool, ...) (*image.Image, error)
- func (daemon *Daemon) Config() *Config
- func (daemon *Daemon) ContainerAttachWithLogs(name string, c *ContainerAttachWithLogsConfig) error
- func (daemon *Daemon) ContainerChanges(name string) ([]archive.Change, error)
- func (daemon *Daemon) ContainerCopy(name string, res string) (io.ReadCloser, error)
- func (daemon *Daemon) ContainerCreate(name string, config *runconfig.Config, hostConfig *runconfig.HostConfig) (string, []string, error)
- func (d *Daemon) ContainerExecCreate(config *runconfig.ExecConfig) (string, error)
- func (daemon *Daemon) ContainerExecInspect(id string) (*execConfig, error)
- func (daemon *Daemon) ContainerExecResize(name string, height, width int) error
- func (d *Daemon) ContainerExecStart(execName string, stdin io.ReadCloser, stdout io.Writer, stderr io.Writer) error
- func (daemon *Daemon) ContainerExport(name string, out io.Writer) error
- func (daemon *Daemon) ContainerGraph() *graphdb.Database
- func (daemon *Daemon) ContainerInspect(name string) (*types.ContainerJSON, error)
- func (daemon *Daemon) ContainerKill(name string, sig uint64) error
- func (daemon *Daemon) ContainerLogs(name string, config *ContainerLogsConfig) error
- func (daemon *Daemon) ContainerPause(name string) error
- func (daemon *Daemon) ContainerRename(oldName, newName string) error
- func (daemon *Daemon) ContainerResize(name string, height, width int) error
- func (daemon *Daemon) ContainerRestart(name string, seconds int) error
- func (daemon *Daemon) ContainerRm(name string, config *ContainerRmConfig) error
- func (daemon *Daemon) ContainerStart(name string, hostConfig *runconfig.HostConfig) error
- func (daemon *Daemon) ContainerStats(name string, stream bool, out io.Writer) error
- func (daemon *Daemon) ContainerStop(name string, seconds int) error
- func (daemon *Daemon) ContainerTop(name string, psArgs string) (*types.ContainerProcessList, error)
- func (daemon *Daemon) ContainerUnpause(name string) error
- func (daemon *Daemon) ContainerWait(name string, timeout time.Duration) (int, error)
- func (daemon *Daemon) ContainerWsAttachWithLogs(name string, c *ContainerWsAttachWithLogsConfig) error
- func (daemon *Daemon) Containers(config *ContainersConfig) ([]*types.Container, error)
- func (daemon *Daemon) Create(config *runconfig.Config, hostConfig *runconfig.HostConfig, name string) (*Container, []string, error)
- func (daemon *Daemon) DeleteVolumes(c *Container) error
- func (daemon *Daemon) Diff(container *Container) (archive.Archive, error)
- func (d *Daemon) Exec(c *Container, execConfig *execConfig, pipes *execdriver.Pipes, ...) (int, error)
- func (daemon *Daemon) ExecutionDriver() execdriver.Driver
- func (daemon *Daemon) Exists(id string) bool
- func (daemon *Daemon) GenerateSecurityOpt(ipcMode runconfig.IpcMode, pidMode runconfig.PidMode) ([]string, error)
- func (daemon *Daemon) Get(prefixOrName string) (*Container, error)
- func (daemon *Daemon) GetByName(name string) (*Container, error)
- func (daemon *Daemon) Graph() *graph.Graph
- func (daemon *Daemon) GraphDriver() graphdriver.Driver
- func (daemon *Daemon) ImageDelete(name string, force, noprune bool) ([]types.ImageDelete, error)
- func (daemon *Daemon) ImageGetCached(imgID string, config *runconfig.Config) (*image.Image, error)
- func (daemon *Daemon) Kill(c *Container, sig int) error
- func (daemon *Daemon) List() []*Container
- func (daemon *Daemon) Mount(container *Container) error
- func (daemon *Daemon) Parents(name string) ([]string, error)
- func (daemon *Daemon) Register(container *Container) error
- func (daemon *Daemon) RegisterLink(parent, child *Container, alias string) error
- func (daemon *Daemon) RegisterLinks(container *Container, hostConfig *runconfig.HostConfig) error
- func (daemon *Daemon) Repositories() *graph.TagStore
- func (daemon *Daemon) Run(c *Container, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (execdriver.ExitStatus, error)
- func (daemon *Daemon) Shutdown() error
- func (daemon *Daemon) Stats(c *Container) (*execdriver.ResourceStats, error)
- func (daemon *Daemon) SubscribeToContainerStats(name string) (chan interface{}, error)
- func (daemon *Daemon) SystemConfig() *sysinfo.SysInfo
- func (daemon *Daemon) SystemInfo() (*types.Info, error)
- func (daemon *Daemon) SystemInitPath() string
- func (daemon *Daemon) Unmount(container *Container) error
- func (daemon *Daemon) UnsubscribeToContainerStats(name string, ch chan interface{}) error
- type History
- type State
- func (s *State) GetExitCode() int
- func (s *State) GetPid() int
- func (s *State) IsPaused() bool
- func (s *State) IsRestarting() bool
- func (s *State) IsRunning() bool
- func (s *State) ResetRemovalInProgress()
- func (s *State) SetDead()
- func (s *State) SetPaused()
- func (s *State) SetRemovalInProgress() error
- func (s *State) SetRestarting(exitStatus *execdriver.ExitStatus)
- func (s *State) SetRunning(pid int)
- func (s *State) SetStopped(exitStatus *execdriver.ExitStatus)
- func (s *State) SetUnpaused()
- func (s *State) StateString() string
- func (s *State) String() string
- func (s *State) WaitRunning(timeout time.Duration) (int, error)
- func (s *State) WaitStop(timeout time.Duration) (int, error)
- type StreamConfig
- func (streamConfig *StreamConfig) StderrLogPipe() io.ReadCloser
- func (streamConfig *StreamConfig) StderrPipe() io.ReadCloser
- func (streamConfig *StreamConfig) StdinPipe() io.WriteCloser
- func (streamConfig *StreamConfig) StdoutLogPipe() io.ReadCloser
- func (streamConfig *StreamConfig) StdoutPipe() io.ReadCloser
Constants ¶
const DefaultPathEnv = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Variables ¶
Functions ¶
func GetFullContainerName ¶
Types ¶
type CommonConfig ¶ added in v1.7.0
type CommonConfig struct { AutoRestart bool // Bridge holds bridge network specific configuration. Bridge bridgeConfig Context map[string][]string CorsHeaders string DisableNetwork bool Dns []string DnsSearch []string EnableCors bool ExecDriver string ExecRoot string GraphDriver string Labels []string LogConfig runconfig.LogConfig Mtu int Pidfile string Root string TrustKeyPath string }
CommonConfig defines the configuration of a docker daemon which are common across platforms.
type CommonContainer ¶ added in v1.7.0
type CommonContainer struct { StreamConfig *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 RestartCount int UpdateDns bool MountPoints map[string]*mountPoint // contains filtered or unexported fields }
CommonContainer holds the settings for a container which are applicable across all platforms supported by the daemon.
type Config ¶ added in v1.2.0
type Config struct { CommonConfig // Fields below here are platform specific. EnableSelinuxSupport bool ExecOptions []string GraphOptions []string SocketGroup string Ulimits map[string]*ulimit.Ulimit }
Config defines 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`
func (*Config) InstallCommonFlags ¶ added in v1.7.0
func (config *Config) InstallCommonFlags()
func (*Config) InstallFlags ¶ added in v1.2.0
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 ¶
type Container struct { CommonContainer AppArmorProfile string // contains filtered or unexported fields }
func (*Container) AllocateNetwork ¶ added in v1.3.0
func (*Container) AttachWithLogs ¶ added in v1.7.0
func (*Container) DisableLink ¶
func (*Container) GetExecIDs ¶ added in v1.5.0
func (*Container) GetMountLabel ¶
func (*Container) GetProcessLabel ¶
func (*Container) GetResourcePath ¶ added in v1.7.0
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 ¶ added in v1.7.0
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) HostConfig ¶
func (container *Container) HostConfig() *runconfig.HostConfig
func (*Container) LogDriverType ¶ added in v1.6.0
func (*Container) ReleaseNetwork ¶ added in v1.3.0
func (container *Container) ReleaseNetwork()
func (*Container) RootfsPath ¶
This method must be exported to be used from the lxc template This directory is only usable when the container is running
func (*Container) SetHostConfig ¶
func (container *Container) SetHostConfig(hostConfig *runconfig.HostConfig)
func (*Container) Stats ¶ added in v1.5.0
func (container *Container) Stats() (*execdriver.ResourceStats, error)
func (*Container) UnmountVolumes ¶ added in v1.7.0
func (*Container) UpdateNetwork ¶ added in v1.7.0
func (*Container) WriteHostConfig ¶
type ContainerAttachWithLogsConfig ¶ added in v1.7.0
type ContainerCommitConfig ¶ added in v1.7.0
type ContainerJSONRaw ¶ added in v1.7.0
type ContainerLogsConfig ¶ added in v1.7.0
type ContainerRmConfig ¶ added in v1.7.0
type ContainerRmConfig struct {
ForceRemove, RemoveVolume, RemoveLink bool
}
type ContainerWsAttachWithLogsConfig ¶ added in v1.7.0
type ContainerWsAttachWithLogsConfig struct { InStream io.ReadCloser OutStream, ErrStream io.Writer Logs, Stream bool }
type ContainersConfig ¶ added in v1.7.0
type Daemon ¶
type Daemon struct { ID string RegistryService *registry.Service EventsService *events.Events // contains filtered or unexported fields }
func (*Daemon) Commit ¶
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) ContainerAttachWithLogs ¶ added in v1.7.0
func (daemon *Daemon) ContainerAttachWithLogs(name string, c *ContainerAttachWithLogsConfig) error
func (*Daemon) ContainerChanges ¶ added in v1.2.0
ContainerChanges returns a list of container fs changes
func (*Daemon) ContainerCopy ¶ added in v1.2.0
func (*Daemon) ContainerCreate ¶ added in v1.2.0
func (*Daemon) ContainerExecCreate ¶ added in v1.3.0
func (d *Daemon) ContainerExecCreate(config *runconfig.ExecConfig) (string, error)
func (*Daemon) ContainerExecInspect ¶ added in v1.4.0
func (*Daemon) ContainerExecResize ¶ added in v1.3.0
func (*Daemon) ContainerExecStart ¶ added in v1.3.0
func (*Daemon) ContainerExport ¶ added in v1.2.0
func (*Daemon) ContainerGraph ¶
func (*Daemon) ContainerInspect ¶ added in v0.12.0
func (daemon *Daemon) ContainerInspect(name string) (*types.ContainerJSON, error)
func (*Daemon) ContainerKill ¶ added in v1.2.0
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 ¶ added in v1.2.0
func (daemon *Daemon) ContainerLogs(name string, config *ContainerLogsConfig) error
func (*Daemon) ContainerPause ¶ added in v1.2.0
ContainerPause pauses a container
func (*Daemon) ContainerRename ¶ added in v1.5.0
func (*Daemon) ContainerResize ¶ added in v1.2.0
func (*Daemon) ContainerRestart ¶ added in v1.2.0
func (*Daemon) ContainerRm ¶ added in v1.3.0
func (daemon *Daemon) ContainerRm(name string, config *ContainerRmConfig) error
func (*Daemon) ContainerStart ¶ added in v1.2.0
func (daemon *Daemon) ContainerStart(name string, hostConfig *runconfig.HostConfig) error
func (*Daemon) ContainerStats ¶ added in v1.5.0
func (*Daemon) ContainerStop ¶ added in v1.2.0
func (*Daemon) ContainerTop ¶ added in v1.2.0
func (*Daemon) ContainerUnpause ¶ added in v1.2.0
ContainerUnpause unpauses a container
func (*Daemon) ContainerWait ¶ added in v1.2.0
func (*Daemon) ContainerWsAttachWithLogs ¶ added in v1.7.0
func (daemon *Daemon) ContainerWsAttachWithLogs(name string, c *ContainerWsAttachWithLogsConfig) error
func (*Daemon) Containers ¶ added in v1.2.0
func (daemon *Daemon) Containers(config *ContainersConfig) ([]*types.Container, error)
func (*Daemon) Create ¶
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 ¶ added in v1.3.0
func (*Daemon) Exec ¶ added in v1.3.0
func (d *Daemon) Exec(c *Container, execConfig *execConfig, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error)
func (*Daemon) ExecutionDriver ¶
func (daemon *Daemon) ExecutionDriver() execdriver.Driver
func (*Daemon) Exists ¶
Exists returns a true if a container of the specified ID or name exists, false otherwise.
func (*Daemon) GenerateSecurityOpt ¶ added in v1.4.0
func (*Daemon) Get ¶
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) 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 ¶
func (daemon *Daemon) GraphDriver() graphdriver.Driver
func (*Daemon) ImageDelete ¶ added in v1.2.0
FIXME: remove ImageDelete's dependency on Daemon, then move to graph/
func (*Daemon) ImageGetCached ¶ added in v1.2.0
func (*Daemon) Register ¶
Register makes a container object usable by the daemon as <container.ID> This is a wrapper for register
func (*Daemon) RegisterLink ¶
func (*Daemon) RegisterLinks ¶ added in v0.12.0
func (daemon *Daemon) RegisterLinks(container *Container, hostConfig *runconfig.HostConfig) error
func (*Daemon) Repositories ¶
func (*Daemon) Run ¶
func (daemon *Daemon) Run(c *Container, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (execdriver.ExitStatus, error)
func (*Daemon) Stats ¶ added in v1.5.0
func (daemon *Daemon) Stats(c *Container) (*execdriver.ResourceStats, error)
func (*Daemon) SubscribeToContainerStats ¶ added in v1.5.0
func (*Daemon) SystemConfig ¶
func (*Daemon) SystemInitPath ¶
func (*Daemon) UnsubscribeToContainerStats ¶ added in v1.5.0
type History ¶
type History []*Container
History is a convenience type for storing a list of containers, ordered by creation date.
type State ¶
type State struct { sync.Mutex 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 (*State) GetExitCode ¶
func (*State) IsRestarting ¶ added in v1.2.0
func (*State) ResetRemovalInProgress ¶ added in v1.6.0
func (s *State) ResetRemovalInProgress()
func (*State) SetRemovalInProgress ¶ added in v1.6.0
func (*State) SetRestarting ¶ added in v1.2.0
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 ¶
func (*State) SetStopped ¶
func (s *State) SetStopped(exitStatus *execdriver.ExitStatus)
func (*State) SetUnpaused ¶ added in v0.12.0
func (s *State) SetUnpaused()
func (*State) StateString ¶ added in v1.3.0
StateString returns a single string to describe state
func (*State) WaitRunning ¶ added in v1.1.0
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
type StreamConfig ¶ added in v1.3.0
type StreamConfig struct {
// contains filtered or unexported fields
}
func (*StreamConfig) StderrLogPipe ¶ added in v1.3.0
func (streamConfig *StreamConfig) StderrLogPipe() io.ReadCloser
func (*StreamConfig) StderrPipe ¶ added in v1.3.0
func (streamConfig *StreamConfig) StderrPipe() io.ReadCloser
func (*StreamConfig) StdinPipe ¶ added in v1.3.0
func (streamConfig *StreamConfig) StdinPipe() io.WriteCloser
func (*StreamConfig) StdoutLogPipe ¶ added in v1.3.0
func (streamConfig *StreamConfig) StdoutLogPipe() io.ReadCloser
func (*StreamConfig) StdoutPipe ¶ added in v1.3.0
func (streamConfig *StreamConfig) StdoutPipe() io.ReadCloser
Source Files ¶
- attach.go
- changes.go
- commit.go
- config.go
- config_linux.go
- container.go
- container_linux.go
- copy.go
- create.go
- daemon.go
- daemon_aufs.go
- daemon_btrfs.go
- daemon_devicemapper.go
- daemon_overlay.go
- daemon_zfs.go
- debugtrap.go
- delete.go
- exec.go
- exec_linux.go
- export.go
- history.go
- image_delete.go
- info.go
- inspect.go
- kill.go
- list.go
- logdrivers_linux.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
- volumes_stubs.go
- wait.go