Documentation ¶
Index ¶
- func Register(name string, handler Handler) error
- type Engine
- func (eng *Engine) Hack_GetGlobalVar(key string) interface{}
- func (eng *Engine) Hack_SetGlobalVar(key string, val interface{})
- func (eng *Engine) Job(name string, args ...string) *Job
- func (eng *Engine) Logf(format string, args ...interface{}) (n int, err error)
- func (eng *Engine) Register(name string, handler Handler) error
- func (eng *Engine) Root() string
- func (eng *Engine) String() string
- type Hack
- type Handler
- type Job
- func (job *Job) CallString() string
- func (job *Job) DecodeEnv(src io.Reader) error
- func (job *Job) EncodeEnv(dst io.Writer) error
- func (job *Job) Environ() map[string]string
- func (job *Job) Errorf(format string, args ...interface{}) (n int, err error)
- func (job *Job) ExportEnv(dst interface{}) (err error)
- func (job *Job) Getenv(key string) (value string)
- func (job *Job) GetenvBool(key string) (value bool)
- func (job *Job) GetenvInt(key string) int64
- func (job *Job) GetenvList(key string) []string
- func (job *Job) ImportEnv(src interface{}) (err error)
- func (job *Job) Logf(format string, args ...interface{}) (n int, err error)
- func (job *Job) Printf(format string, args ...interface{}) (n int, err error)
- func (job *Job) Run() error
- func (job *Job) Setenv(key, value string)
- func (job *Job) SetenvBool(key string, value bool)
- func (job *Job) SetenvInt(key string, value int64)
- func (job *Job) SetenvList(key string, value []string) error
- func (job *Job) StatusString() string
- func (job *Job) StderrParseLines(dst *[]string, limit int)
- func (job *Job) StderrParseString(dst *string)
- func (job *Job) StderrPipe() io.ReadCloser
- func (job *Job) StdoutParseLines(dst *[]string, limit int)
- func (job *Job) StdoutParseString(dst *string)
- func (job *Job) StdoutPipe() io.ReadCloser
- func (job *Job) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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) Hack_GetGlobalVar ¶ added in v0.6.7
func (*Engine) Hack_SetGlobalVar ¶ added in v0.6.7
func (*Engine) Job ¶
Job creates a new job which can later be executed. This function mimics `Command` from the standard os/exec package.
type Job ¶
type Job struct { Eng *Engine Name string Args []string Stdin io.Reader Stdout io.Writer Stderr io.Writer // 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) CallString ¶ added in v0.6.7
func (*Job) DecodeEnv ¶ added in v0.6.7
DecodeEnv decodes `src` as a json dictionary, and adds each decoded key-value pair to the environment.
If `text` cannot be decoded as a json dictionary, an error is returned.
func (*Job) GetenvBool ¶
func (*Job) GetenvList ¶
func (*Job) Run ¶
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) SetenvBool ¶
func (*Job) StatusString ¶ added in v0.6.7
func (*Job) StderrParseLines ¶ added in v0.6.7
func (*Job) StderrParseString ¶ added in v0.6.7
func (*Job) StderrPipe ¶ added in v0.6.7
func (job *Job) StderrPipe() io.ReadCloser
func (*Job) StdoutParseLines ¶ added in v0.6.7
func (*Job) StdoutParseString ¶ added in v0.6.7
func (*Job) StdoutPipe ¶ added in v0.6.7
func (job *Job) StdoutPipe() io.ReadCloser