Documentation ¶
Index ¶
- Constants
- Variables
- func CallURL(method, URL, path string, data interface{}) ([]byte, int, error)
- func GetDefaultNetworkMtu() int
- func GetFullContainerName(name string) (string, error)
- type Config
- type Container
- func (container *Container) AllocateNetwork() 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(options *archive.ChangeOptions) (archive.Archive, error)
- func (container *Container) Exposes(p nat.Port) bool
- func (container *Container) FromDisk() error
- func (container *Container) GetImage() (*image.Image, error)
- func (container *Container) GetMountLabel() string
- func (container *Container) GetProcessLabel() string
- func (container *Container) GetPtyMaster() (*os.File, 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 (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) ReadCommandConfig() error
- func (container *Container) ReadLog(name string) (io.Reader, error)
- func (container *Container) ReadMonitorState() error
- func (container *Container) ReleaseNetwork()
- func (container *Container) Resize(h, w int) error
- func (container *Container) Restart(seconds int) error
- func (container *Container) RestoreNetwork() 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) Stop(seconds int) error
- func (container *Container) ToDisk() error
- func (container *Container) Unmount() error
- func (container *Container) Unpause() error
- func (container *Container) VolumeMounts() map[string]*Mount
- func (container *Container) VolumePaths() map[string]struct{}
- func (container *Container) WriteCommandConfig() error
- func (container *Container) WriteHostConfig() error
- func (container *Container) WriteMonitorState() error
- type Daemon
- func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, tty bool, ...) chan error
- func (daemon *Daemon) Changes(container *Container) ([]archive.Change, error)
- func (daemon *Daemon) Children(name string) (map[string]*Container, error)
- func (daemon *Daemon) CmdInfo(job *engine.Job) engine.Status
- func (daemon *Daemon) Commit(container *Container, repository, tag, comment, author string, pause bool, ...) (*image.Image, error)
- func (daemon *Daemon) Config() *Config
- func (daemon *Daemon) ContainerAttach(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerCgroup(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerChanges(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerCommit(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerCopy(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerCreate(job *engine.Job) engine.Status
- func (d *Daemon) ContainerExecCreate(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerExecResize(job *engine.Job) engine.Status
- func (d *Daemon) ContainerExecStart(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerExport(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerGraph() *graphdb.Database
- func (daemon *Daemon) ContainerInspect(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerKill(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerLogs(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerMonitorOp(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerPause(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerResize(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerRestart(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerRm(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerSet(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerStart(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerStop(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerTop(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerUnpause(job *engine.Job) engine.Status
- func (daemon *Daemon) ContainerWait(job *engine.Job) engine.Status
- func (daemon *Daemon) Containers(job *engine.Job) engine.Status
- func (daemon *Daemon) Create(config *runconfig.Config, hostConfig *runconfig.HostConfig, name string) (*Container, []string, error)
- func (daemon *Daemon) DeleteImage(eng *engine.Engine, name string, imgs *engine.Table, ...) error
- func (daemon *Daemon) DeleteVolumes(volumeIDs map[string]struct{})
- func (daemon *Daemon) Destroy(container *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) Get(name string) *Container
- func (daemon *Daemon) GetByName(name string) (*Container, error)
- func (daemon *Daemon) Graph() *graph.Graph
- func (daemon *Daemon) GraphDriver() graphdriver.Driver
- func (daemon *Daemon) ImageDelete(job *engine.Job) engine.Status
- func (daemon *Daemon) ImageGetCached(imgID string, config *runconfig.Config) (*image.Image, error)
- func (daemon *Daemon) Install(eng *engine.Engine) error
- func (daemon *Daemon) Kill(c *Container, sig int) error
- func (daemon *Daemon) List() []*Container
- func (daemon *Daemon) LogToDisk(src *broadcastwriter.BroadcastWriter, dst, stream string) error
- func (daemon *Daemon) Mount(container *Container) error
- func (daemon *Daemon) Nuke() error
- func (daemon *Daemon) Parents(name string) ([]string, error)
- func (daemon *Daemon) Pause(c *Container) 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) (int, error)
- func (daemon *Daemon) SystemConfig() *sysinfo.SysInfo
- func (daemon *Daemon) SystemInitPath() string
- func (daemon *Daemon) Unmount(container *Container) error
- func (daemon *Daemon) Unpause(c *Container) error
- type DockerMonitor
- func (dm *DockerMonitor) Container() *Container
- func (dm *DockerMonitor) ContainerState() *WatchState
- func (dm *DockerMonitor) KillSig(sig int) error
- func (dm *DockerMonitor) RestartWatching()
- func (dm *DockerMonitor) Start() error
- func (dm *DockerMonitor) Stop() (error, int)
- func (dm *DockerMonitor) WaitStop() error
- type HTTPClient
- type History
- type MonitorConfig
- type MonitorProxy
- type MonitorState
- type Mount
- type NetworkSettings
- type PortMapping
- 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) SetPaused()
- func (s *State) SetRestarting(exitCode int)
- func (s *State) SetRunning(pid int)
- func (s *State) SetStopped(exitCode int)
- func (s *State) SetUnpaused()
- func (s *State) StateString() string
- func (s *State) String() string
- func (s *State) ToWatchState() *WatchState
- func (s *State) WaitRunning(timeout time.Duration) (int, error)
- func (s *State) WaitStop(timeout time.Duration) (int, error)
- type StatePoller
- type StateWatcher
- type StreamConfig
- func (streamConfig *StreamConfig) StderrLogPipe() io.ReadCloser
- func (streamConfig *StreamConfig) StderrPipe() (io.ReadCloser, error)
- func (streamConfig *StreamConfig) StdinPipe() (io.WriteCloser, error)
- func (streamConfig *StreamConfig) StdoutLogPipe() io.ReadCloser
- func (streamConfig *StreamConfig) StdoutPipe() (io.ReadCloser, error)
- type WatchState
Constants ¶
const DefaultPathEnv = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
const WatchStateEvent = "WatchState"
Variables ¶
var ( MonitorSockDir = "/var/run/docker" MonitorBuiltin = "builtin" MonitorExternal = "external" )
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.") )
var (
DefaultDns = []string{"8.8.8.8", "8.8.4.4"}
)
Functions ¶
func GetDefaultNetworkMtu ¶
func GetDefaultNetworkMtu() int
func GetFullContainerName ¶
Types ¶
type Config ¶
type Config struct { Pidfile string Root string AutoRestart bool Dns []string DnsSearch []string Mirrors []string EnableIptables bool EnableIpForward bool EnableIpMasq bool DefaultIp net.IP BridgeIface string BridgeIP string FixedCIDR string InsecureRegistries []string InterContainerCommunication bool GraphDriver string GraphOptions []string ExecDriver string Mtu int DisableNetwork bool EnableSelinuxSupport bool Context map[string][]string }
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 ¶
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 { *State `json:"State"` // Needed for remote api version <= 1.11 ID string Created time.Time Path string Args []string Config *runconfig.Config Image string NetworkSettings *NetworkSettings ResolvConfPath string HostnamePath string HostsPath string Name string Driver string ExecDriver string StreamConfig MountLabel, ProcessLabel string AppArmorProfile string RestartCount int // 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 //MonitorDriver builtin or external MonitorDriver string // contains filtered or unexported fields }
func (*Container) AllocateNetwork ¶
func (*Container) DisableLink ¶
func (*Container) GetMountLabel ¶
func (*Container) GetProcessLabel ¶
func (*Container) HostConfig ¶
func (container *Container) HostConfig() *runconfig.HostConfig
func (*Container) ReadCommandConfig ¶
func (*Container) ReadMonitorState ¶
func (*Container) ReleaseNetwork ¶
func (container *Container) ReleaseNetwork()
func (*Container) RestoreNetwork ¶
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) VolumeMounts ¶
func (*Container) VolumePaths ¶
func (*Container) WriteCommandConfig ¶
func (*Container) WriteHostConfig ¶
func (*Container) WriteMonitorState ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
func NewDaemonFromDirectory ¶
func (*Daemon) Attach ¶
func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, tty bool, stdin io.ReadCloser, stdinCloser io.Closer, stdout io.Writer, stderr io.Writer) chan error
FIXME: this should be private, and every outside subsystem should go through the "container_attach" job. But that would require that job to be properly documented, as well as the relationship between Attach and ContainerAttach.
This method is in use by builder/builder.go.
func (*Daemon) Commit ¶
func (daemon *Daemon) Commit(container *Container, repository, tag, comment, author string, pause bool, options *archive.ChangeOptions, 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) ContainerAttach ¶
func (*Daemon) ContainerCgroup ¶
func (*Daemon) ContainerChanges ¶
func (*Daemon) ContainerCommit ¶
func (*Daemon) ContainerCreate ¶
func (*Daemon) ContainerExecCreate ¶
func (*Daemon) ContainerExecResize ¶
func (*Daemon) ContainerExecStart ¶
func (*Daemon) ContainerExport ¶
func (*Daemon) ContainerGraph ¶
func (*Daemon) ContainerInspect ¶
func (*Daemon) ContainerKill ¶
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) ContainerMonitorOp ¶
ContainerMonitorOp only called at attach mode by docker client to stop monitor server
func (*Daemon) ContainerResize ¶
func (*Daemon) ContainerRestart ¶
func (*Daemon) ContainerUnpause ¶
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) DeleteImage ¶
func (daemon *Daemon) DeleteImage(eng *engine.Engine, name string, imgs *engine.Table, first, force, noprune bool) error
FIXME: make this private and use the job instead
func (*Daemon) DeleteVolumes ¶
func (*Daemon) Destroy ¶
Destroy unregisters a container from the daemon and cleanly removes its contents from the filesystem. FIXME: rename to Rm for consistency with the CLI command
func (*Daemon) Exec ¶
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) Get ¶
Get looks for a container by the specified ID or name, and returns it. If the container is not found, or if an error occurs, nil 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) ImageGetCached ¶
func (*Daemon) LogToDisk ¶
func (daemon *Daemon) LogToDisk(src *broadcastwriter.BroadcastWriter, dst, stream string) error
func (*Daemon) Nuke ¶
Nuke kills all containers then removes all content from the content root, including images, volumes and container filesystems. Again: this will remove your entire docker daemon! FIXME: this is deprecated, and only used in legacy tests. Please remove.
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 ¶
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) (int, error)
func (*Daemon) SystemConfig ¶
func (*Daemon) SystemInitPath ¶
type DockerMonitor ¶
type DockerMonitor struct {
// contains filtered or unexported fields
}
func InitDockerMonitor ¶
func InitDockerMonitor(cfg *MonitorConfig, w *StateWatcher) *DockerMonitor
func (*DockerMonitor) Container ¶
func (dm *DockerMonitor) Container() *Container
func (*DockerMonitor) ContainerState ¶
func (dm *DockerMonitor) ContainerState() *WatchState
func (*DockerMonitor) KillSig ¶
func (dm *DockerMonitor) KillSig(sig int) error
func (*DockerMonitor) RestartWatching ¶
func (dm *DockerMonitor) RestartWatching()
func (*DockerMonitor) Start ¶
func (dm *DockerMonitor) Start() error
func (*DockerMonitor) Stop ¶
func (dm *DockerMonitor) Stop() (error, int)
func (*DockerMonitor) WaitStop ¶
func (dm *DockerMonitor) WaitStop() error
type HTTPClient ¶
type History ¶
type History []*Container
History is a convenience type for storing a list of containers, ordered by creation date.
type MonitorConfig ¶
type MonitorProxy ¶
type MonitorProxy struct {
// contains filtered or unexported fields
}
MonitorProxy monitor proxy
func NewMonitorProxy ¶
func NewMonitorProxy(c *Container, createCmd bool) *MonitorProxy
NewMonitorProxy return proxy for extern monitor
func (*MonitorProxy) RunStatePoller ¶
func (m *MonitorProxy) RunStatePoller() error
func (*MonitorProxy) Start ¶
func (m *MonitorProxy) Start() error
func (*MonitorProxy) Stop ¶
func (m *MonitorProxy) Stop() error
Stop closes the container's resources such as networking allocations and unmounts the contatiner's root filesystem
func (*MonitorProxy) StopStatePoller ¶
func (m *MonitorProxy) StopStatePoller()
type MonitorState ¶
type MonitorState struct { sync.Mutex Running bool Pid int ExitCode int StartedAt time.Time FinishedAt time.Time }
func NewMonitorState ¶
func NewMonitorState() *MonitorState
func (*MonitorState) IsRunning ¶
func (ms *MonitorState) IsRunning() bool
func (*MonitorState) SetRunning ¶
func (ms *MonitorState) SetRunning(pid int)
func (*MonitorState) SetStopped ¶
func (ms *MonitorState) SetStopped(exitCode int)
type NetworkSettings ¶
type NetworkSettings struct { IPAddress string IPPrefixLen int MacAddress string Gateway string Bridge string PortMapping map[string]PortMapping // Deprecated Ports nat.PortMap }
func (*NetworkSettings) PortMappingAPI ¶
func (settings *NetworkSettings) PortMappingAPI() *engine.Table
type PortMapping ¶
FIXME: move deprecated port stuff to nat to clean up the core.
type State ¶
type State struct { sync.Mutex Running bool Paused bool Restarting bool Pid int ExitCode int StartedAt time.Time FinishedAt time.Time // contains filtered or unexported fields }
func (*State) GetExitCode ¶
func (*State) IsRestarting ¶
func (*State) SetRestarting ¶
SetRestarting is when docker hanldes 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 (*State) SetUnpaused ¶
func (s *State) SetUnpaused()
func (*State) StateString ¶
StateString returns a single string to describe state
func (*State) ToWatchState ¶
func (s *State) ToWatchState() *WatchState
func (*State) WaitRunning ¶
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 StatePoller ¶
func (*StatePoller) Run ¶
func (p *StatePoller) Run() error
Run begins polling. It starts a goroutine and returns immediately.
func (*StatePoller) Stop ¶
func (p *StatePoller) Stop()
type StateWatcher ¶
func NewStateWatcher ¶
func NewStateWatcher() *StateWatcher
func (*StateWatcher) Emit ¶
func (sw *StateWatcher) Emit(obj watch.Object)
Emit sends a watch event.
func (*StateWatcher) ResultChan ¶
func (sw *StateWatcher) ResultChan() <-chan watch.Event
func (*StateWatcher) Start ¶
func (sw *StateWatcher) Start()
func (*StateWatcher) Stop ¶
func (sw *StateWatcher) Stop()
type StreamConfig ¶
type StreamConfig struct {
// contains filtered or unexported fields
}
func (*StreamConfig) StderrLogPipe ¶
func (streamConfig *StreamConfig) StderrLogPipe() io.ReadCloser
func (*StreamConfig) StderrPipe ¶
func (streamConfig *StreamConfig) StderrPipe() (io.ReadCloser, error)
func (*StreamConfig) StdinPipe ¶
func (streamConfig *StreamConfig) StdinPipe() (io.WriteCloser, error)
func (*StreamConfig) StdoutLogPipe ¶
func (streamConfig *StreamConfig) StdoutLogPipe() io.ReadCloser
func (*StreamConfig) StdoutPipe ¶
func (streamConfig *StreamConfig) StdoutPipe() (io.ReadCloser, error)
Source Files ¶
- attach.go
- cgroup.go
- changes.go
- commit.go
- config.go
- config_monitor.go
- container.go
- copy.go
- create.go
- daemon.go
- daemon_aufs.go
- daemon_btrfs.go
- daemon_devicemapper.go
- delete.go
- exec.go
- export.go
- history.go
- image_delete.go
- info.go
- inspect.go
- kill.go
- list.go
- logs.go
- monitor.go
- monitor_ext.go
- monitor_proxy.go
- network_settings.go
- pause.go
- resize.go
- restart.go
- set.go
- start.go
- state.go
- stop.go
- top.go
- utils.go
- utils_linux.go
- volumes.go
- wait.go
- watch.go