runtime

package
v0.6.2-0...-8bcb156 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2014 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPathEnv = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
View Source
const MaxImageDepth = 127

Set the max depth to the aufs default that most kernels are compiled with For more information see: http://sourceforge.net/p/aufs/aufs3-standalone/ci/aufs3.12/tree/config.mk

Variables

View Source
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.")
)
View Source
var (
	DefaultDns = []string{"8.8.8.8", "8.8.4.4"}
)

Functions

func GetFullContainerName

func GetFullContainerName(name string) (string, error)

Types

type BindMap

type BindMap struct {
	SrcPath string
	DstPath string
	Mode    string
}

type Container

type Container struct {
	sync.Mutex

	ID string

	Created time.Time

	Path string
	Args []string

	Config *runconfig.Config
	State  State
	Image  string

	NetworkSettings *NetworkSettings

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

	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
	// contains filtered or unexported fields
}

func (*Container) Attach

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

func (*Container) BasefsPath

func (container *Container) BasefsPath() string

This is the stand-alone version of the root fs, without any additional mounts. This directory is usable whenever the container is mounted (and not unmounted)

func (*Container) Changes

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

func (*Container) Copy

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

func (*Container) EnvConfigPath

func (container *Container) EnvConfigPath() (string, error)

func (*Container) Export

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

func (*Container) ExportRw

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

func (*Container) Exposes

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

Returns true if the container exposes a certain port

func (*Container) FromDisk

func (container *Container) FromDisk() error

func (*Container) GetImage

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

func (*Container) GetPtyMaster

func (container *Container) GetPtyMaster() (*os.File, error)

func (*Container) GetSize

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

GetSize, return real size, virtual size

func (*Container) HostConfig

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

func (*Container) Inject

func (container *Container) Inject(file io.Reader, pth string) error

Inject the io.Reader at the given path. Note: do not close the reader

func (*Container) Kill

func (container *Container) Kill() error

func (*Container) KillSig

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

func (*Container) Mount

func (container *Container) Mount() error

func (*Container) Output

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

func (*Container) ReadLog

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

func (*Container) Resize

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

func (*Container) Restart

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

func (*Container) RootfsPath

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

func (container *Container) Run() error

func (*Container) SetHostConfig

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

func (*Container) Start

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

func (*Container) StderrPipe

func (container *Container) StderrPipe() (io.ReadCloser, error)

func (*Container) StdinPipe

func (container *Container) StdinPipe() (io.WriteCloser, error)

func (*Container) StdoutPipe

func (container *Container) StdoutPipe() (io.ReadCloser, error)

func (*Container) Stop

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

func (*Container) ToDisk

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

func (*Container) Unmount

func (container *Container) Unmount() error

func (*Container) Wait

func (container *Container) Wait() int

Wait blocks until the container stops running, then returns its exit code.

func (*Container) WaitTimeout

func (container *Container) WaitTimeout(timeout time.Duration) error

func (*Container) When

func (container *Container) When() time.Time

func (*Container) WriteHostConfig

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

type History

type History []*Container

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

func (*History) Add

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

func (*History) Len

func (history *History) Len() int

func (*History) Less

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

func (*History) Swap

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

type NetworkSettings

type NetworkSettings struct {
	IPAddress   string
	IPPrefixLen int
	Gateway     string
	Bridge      string
	PortMapping map[string]PortMapping // Deprecated
	Ports       nat.PortMap
}

func (*NetworkSettings) PortMappingAPI

func (settings *NetworkSettings) PortMappingAPI() *engine.Table

type PortMapping

type PortMapping map[string]string // Deprecated

FIXME: move deprecated port stuff to nat to clean up the core.

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

func NewRuntime

func NewRuntime(config *daemonconfig.Config, eng *engine.Engine) (*Runtime, error)

FIXME: harmonize with NewGraph()

func NewRuntimeFromDirectory

func NewRuntimeFromDirectory(config *daemonconfig.Config, eng *engine.Engine) (*Runtime, error)

func (*Runtime) Changes

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

func (*Runtime) Children

func (runtime *Runtime) Children(name string) (map[string]*Container, error)

func (*Runtime) Close

func (runtime *Runtime) Close() error

func (*Runtime) Commit

func (runtime *Runtime) Commit(container *Container, repository, tag, comment, author string, 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 (*Runtime) Config

func (runtime *Runtime) Config() *daemonconfig.Config

func (*Runtime) ContainerGraph

func (runtime *Runtime) ContainerGraph() *graphdb.Database

func (*Runtime) Create

func (runtime *Runtime) Create(config *runconfig.Config, name string) (*Container, []string, error)

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

func (*Runtime) Destroy

func (runtime *Runtime) Destroy(container *Container) error

Destroy unregisters a container from the runtime and cleanly removes its contents from the filesystem.

func (*Runtime) Diff

func (runtime *Runtime) Diff(container *Container) (archive.Archive, error)

func (*Runtime) ExecutionDriver

func (runtime *Runtime) ExecutionDriver() execdriver.Driver

func (*Runtime) Exists

func (runtime *Runtime) Exists(id string) bool

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

func (*Runtime) Get

func (runtime *Runtime) Get(name string) *Container

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 (*Runtime) GetByName

func (runtime *Runtime) GetByName(name string) (*Container, error)

func (*Runtime) Graph

func (runtime *Runtime) Graph() *graph.Graph

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

func (*Runtime) GraphDriver

func (runtime *Runtime) GraphDriver() graphdriver.Driver

func (*Runtime) Kill

func (runtime *Runtime) Kill(c *Container, sig int) error

func (*Runtime) List

func (runtime *Runtime) List() []*Container

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

func (*Runtime) LogToDisk

func (runtime *Runtime) LogToDisk(src *utils.WriteBroadcaster, dst, stream string) error

func (*Runtime) Mount

func (runtime *Runtime) Mount(container *Container) error

func (*Runtime) Nuke

func (runtime *Runtime) Nuke() error

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 runtime!

func (*Runtime) Register

func (runtime *Runtime) Register(container *Container) error

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

func (runtime *Runtime) RegisterLink(parent, child *Container, alias string) error

func (*Runtime) Repositories

func (runtime *Runtime) Repositories() *graph.TagStore

func (*Runtime) Run

func (runtime *Runtime) Run(c *Container, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error)

func (*Runtime) SetServer

func (runtime *Runtime) SetServer(server Server)

func (*Runtime) SystemConfig

func (runtime *Runtime) SystemConfig() *sysinfo.SysInfo

func (*Runtime) SystemInitPath

func (runtime *Runtime) SystemInitPath() string

func (*Runtime) Unmount

func (runtime *Runtime) Unmount(container *Container) error

func (*Runtime) Volumes

func (runtime *Runtime) Volumes() *graph.Graph

type Server

type Server interface {
	LogEvent(action, id, from string) *utils.JSONMessage
	IsRunning() bool // returns true if the server is currently in operation
}

type State

type State struct {
	sync.RWMutex
	Running    bool
	Pid        int
	ExitCode   int
	StartedAt  time.Time
	FinishedAt time.Time
	Ghost      bool
}

func (*State) GetExitCode

func (s *State) GetExitCode() int

func (*State) IsGhost

func (s *State) IsGhost() bool

func (*State) IsRunning

func (s *State) IsRunning() bool

func (*State) SetGhost

func (s *State) SetGhost(val bool)

func (*State) SetRunning

func (s *State) SetRunning(pid int)

func (*State) SetStopped

func (s *State) SetStopped(exitCode int)

func (*State) String

func (s *State) String() string

String returns a human-readable description of the state

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL