engine

package
v0.5.1-0...-fc45535 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2013 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, handler Handler) error

Types

type Engine

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

The Engine is the core of Docker. It acts as a store for *containers*, and allows manipulation of these containers by executing *jobs*.

func New

func New(root string) (*Engine, error)

New initializes a new engine managing the directory specified at `root`. `root` is used to store containers and any other state private to the engine. Changing the contents of the root without executing a job will cause unspecified behavior.

func (*Engine) Job

func (eng *Engine) Job(name string, args ...string) *Job

Job creates a new job which can later be executed. This function mimics `Command` from the standard os/exec package.

type Handler

type Handler func(*Job) string

type Job

type Job struct {
	Name string
	Args []string

	Stdin  io.ReadCloser
	Stdout io.WriteCloser
	Stderr io.WriteCloser
	// contains filtered or unexported fields
}

A job is the fundamental unit of work in the docker engine. Everything docker can do should eventually be exposed as a job. For example: execute a process in a container, create a new container, download an archive from the internet, serve the http api, etc.

The job API is designed after unix processes: a job has a name, arguments, environment variables, standard streams for input, output and error, and an exit status which can indicate success (0) or error (anything else).

One slight variation is that jobs report their status as a string. The string "0" indicates success, and any other strings indicates an error. This allows for richer error reporting.

func (*Job) Getenv

func (job *Job) Getenv(key string) (value string)

func (*Job) GetenvBool

func (job *Job) GetenvBool(key string) (value bool)

func (*Job) GetenvList

func (job *Job) GetenvList(key string) []string

func (*Job) Run

func (job *Job) Run() error

Run executes the job and blocks until the job completes. If the job returns a failure status, an error is returned which includes the status.

func (*Job) Setenv

func (job *Job) Setenv(key, value string)

func (*Job) SetenvBool

func (job *Job) SetenvBool(key string, value bool)

func (*Job) SetenvList

func (job *Job) SetenvList(key string, value []string) error

func (*Job) String

func (job *Job) String() string

String returns a human-readable description of `job`

Jump to

Keyboard shortcuts

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