docker

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2018 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package docker implements the docker task types.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Tasks is a map of all docker tasks.
	Tasks = map[string]tasks.Task{
		"build":       &Build{},
		"export":      &Export{},
		"import":      &Import{},
		"login":       &Login{},
		"logout":      &Logout{},
		"pull":        &Pull{},
		"push":        &Push{},
		"remove":      &Remove{},
		"run":         &Run{},
		"tag":         &Tag{},
		"environment": &Environment{},
	}
)

Functions

func Docker added in v0.8.0

func Docker(name, template string, params map[string]interface{}, st *state.State) error

Docker runs a docker command.

func DockerOutput added in v0.8.0

func DockerOutput(name, template string, params map[string]interface{}, st *state.State) (string, string, error)

DockerOutput runs a docker command but returns the output rather than outputting to the logger.

func ParseImage added in v0.8.0

func ParseImage(image string) (string, string, string)

ParseImage will convert an image like python:3 to it's registry, name, and tag

func StopContainer added in v0.9.0

func StopContainer(cid string, logger *gomol.LogAdapter, st *state.State) error

StopContainer will call 'docker stop' on the given container id

Types

type Build

type Build struct {
	Dockerfile string             `yaml:"dockerfile"`
	Files      yaml.StringOrSlice `yaml:"files"`
	Tag        string             `yaml:"tag"`
	Tags       yaml.StringOrSlice `yaml:"tags"`
	Target     string             `yaml:"target"`
	Labels     yaml.StringOrSlice `yaml:"labels"`
	Arguments  yaml.StringOrSlice `yaml:"arguments"`
}

Build defines the options for building a docker image.

func (*Build) Execute

func (b *Build) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error

Execute runs the docker build command

func (*Build) New

func (b *Build) New() tasks.Task

New creates a new docker build task.

func (*Build) Valid

func (b *Build) Valid() error

Valid checks that the build task is valid.

type Environment added in v0.11.0

type Environment struct {
	File   string             `yaml:"from-file"`
	Files  yaml.StringOrSlice `yaml:"from-files"`
	Prefix string             `yaml:"prefix"`
}

Environment contains options for loading environment variables from a file in the workspace.

func (*Environment) Execute added in v0.11.0

func (e *Environment) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error

Execute runs the environment plan.

func (*Environment) New added in v0.11.0

func (e *Environment) New() tasks.Task

New creates a new environment command.

func (*Environment) Valid added in v0.11.0

func (e *Environment) Valid() error

Valid validate the environment command.

type Export

type Export struct {
	Files yaml.StringOrSlice `yaml:"files"`
}

Export represents an export task which exports files from the workspace to the host.

func (*Export) Execute

func (e *Export) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error

Execute runs the export task.

func (*Export) New

func (e *Export) New() tasks.Task

New creates a new Export task.

func (*Export) Valid

func (e *Export) Valid() error

Valid validates the export task.

type HealthCheck added in v0.9.0

type HealthCheck struct {
	Command     string        `yaml:"command"`
	Interval    time.Duration `yaml:"interval"`
	Retries     int           `yaml:"retries"`
	StartPeriod time.Duration `yaml:"start-period"`
	Timeout     time.Duration `yaml:"timeout"`
}

HealthCheck represents a docker health check.

type Import

type Import struct {
	Files yaml.StringOrSlice `yaml:"files"`
}

Import represents an import task which imports files from the host to the workspace.

func (*Import) Execute

func (i *Import) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error

Execute runs the import task.

func (*Import) New

func (i *Import) New() tasks.Task

New creates a new import task.

func (*Import) Valid

func (i *Import) Valid() error

Valid validates the import task.

type Login

type Login struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	Server   string `yaml:"server"`
}

Login represents an login task for logging into a docker registry.

func (*Login) Execute

func (l *Login) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error

Execute runs the login task.

func (*Login) New

func (l *Login) New() tasks.Task

New creates a new login task.

func (*Login) Valid

func (l *Login) Valid() error

Valid validate the login task.

type Logout

type Logout struct {
	Server string `yaml:"server"`
}

Logout represents a logout task which logs out of a docker registry.

func (*Logout) Execute

func (l *Logout) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error

Execute runs the logout task.

func (*Logout) New

func (l *Logout) New() tasks.Task

New creates a new logout task.

func (*Logout) Valid

func (l *Logout) Valid() error

Valid validates the logout task.

type Network added in v0.9.0

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

Network represents a docker network.

func NewNetwork added in v0.9.0

func NewNetwork(st *state.State) (*Network, error)

NewNetwork creates a new docker network.

func (*Network) Destroy added in v0.9.0

func (network *Network) Destroy() error

Destroy tears down the docker network.

func (*Network) Name added in v0.9.0

func (network *Network) Name() string

Name returns the name of the network.

type Pull

type Pull struct {
	Image  string             `yaml:"image"`
	Images yaml.StringOrSlice `yaml:"images"`
}

Pull represents a docker pull task which pulls an image from a docker registry.

func (*Pull) Execute

func (p *Pull) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error

Execute runs the pull task.

func (*Pull) New

func (p *Pull) New() tasks.Task

New creates a new pull task.

func (*Pull) Valid

func (p *Pull) Valid() error

Valid validates the pull task.

type Push

type Push struct {
	Image  string             `yaml:"image"`
	Images yaml.StringOrSlice `yaml:"images"`
}

Push represents a docker push task which push an image to a docker registry.

func (*Push) Execute

func (p *Push) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error

Execute runs the push task.

func (*Push) New

func (p *Push) New() tasks.Task

New creates a new push task.

func (*Push) Valid

func (p *Push) Valid() error

Valid validates the push task.

type Remove

type Remove struct {
	Image  string             `yaml:"image"`
	Images yaml.StringOrSlice `yaml:"images"`
	Quiet  bool               `yaml:"quiet"`
}

Remove represents a docker rm task which deletes a local docker image.

func (*Remove) Execute

func (r *Remove) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error

Execute runs the remove task.

func (*Remove) New

func (r *Remove) New() tasks.Task

New creates a new remove task.

func (*Remove) Valid

func (r *Remove) Valid() error

Valid validates the remove task.

type Run

type Run struct {
	Command     string             `yaml:"command"`
	Detach      bool               `yaml:"detach"`
	Hostname    string             `yaml:"hostname"`
	EntryPoint  string             `yaml:"entrypoint"`
	Environment yaml.StringOrSlice `yaml:"environment"`
	Image       string             `yaml:"image"`
	WorkDir     string             `yaml:"workdir"`
	WorkSpace   string             `yaml:"workspace"`
	Script      yaml.StringOrSlice `yaml:"script"`
	Shell       string             `yaml:"shell"`
	Labels      yaml.StringOrSlice `yaml:"labels"`
	User        string             `yaml:"user"`
	HealthCheck HealthCheck        `yaml:"healthcheck"`
}

Run represents a docker run task which will run a container.

func (*Run) Execute

func (r *Run) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error

Execute runs the run task.

func (*Run) New

func (r *Run) New() tasks.Task

New creates a new run task.

func (*Run) UnmarshalYAML added in v0.5.0

func (r *Run) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is a custom yaml unmarshaller for run tasks.

func (*Run) Valid

func (r *Run) Valid() error

Valid validates the run task.

type Tag

type Tag struct {
	Source       string             `yaml:"source"`
	Destination  string             `yaml:"destination"`
	Destinations yaml.StringOrSlice `yaml:"destinations"`
}

Tag represents a docker tag command.

func (*Tag) Execute

func (t *Tag) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error

Execute runs the execute task.

func (*Tag) New

func (t *Tag) New() tasks.Task

New creates a new docker tag task.

func (*Tag) Valid

func (t *Tag) Valid() error

Valid validates the tag task.

type Workspace added in v0.9.0

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

Workspace represents a docker workspace.

func NewWorkspace added in v0.9.0

func NewWorkspace(st *state.State) (*Workspace, error)

NewWorkspace creates a new docker workspace.

func (*Workspace) Destroy added in v0.9.0

func (ws *Workspace) Destroy() error

Destroy removes the docker workspace.

func (*Workspace) Name added in v0.9.0

func (ws *Workspace) Name() string

Name returns the name of the docker workspace.

Jump to

Keyboard shortcuts

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