docker

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// NodeLabelPrefix is the constraint key prefix for node labels.
	NodeLabelPrefix = "node.labels."
	// EngineLabelPrefix is the constraint key prefix for engine labels.
	EngineLabelPrefix = "engine.labels."
)
View Source
const (
	DefaultURL     = "unix:///var/run/docker.sock"
	DefaultVersion = "1.32"
	MinVersion     = "1.32"
)

Docker constants

View Source
const (
	StatePreparing      = "PREPARING"
	StateReady          = "READY"
	StateStarting       = "STARTING"
	StateRunning        = "RUNNING"
	StateComplete       = "COMPLETE"
	StateError          = "ERROR"
	StateNoMatchingNode = "NO MATCHING NODE"
)

Docker states

Variables

This section is empty.

Functions

func NewDockerCli added in v0.16.0

func NewDockerCli(stdin io.ReadCloser, stdout, stderr io.Writer) *command.DockerCli

func NodeMatches added in v0.18.0

func NodeMatches(constraints []Constraint, n *swarm.Node) bool

NodeMatches returns true if the node satisfies the given constraints.

Types

type Constraint added in v0.18.0

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

Constraint defines a constraint.

func Parse added in v0.18.0

func Parse(env []string) ([]Constraint, error)

Parse parses list of constraints.

func (*Constraint) Match added in v0.18.0

func (c *Constraint) Match(whats ...string) bool

Match checks if the Constraint matches the target strings.

type Docker

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

Docker wrapper

func NewClient

func NewClient(url string, version string) *Docker

NewClient instantiates a new Docker wrapper

func NewEnvClient added in v0.18.0

func NewEnvClient() *Docker

NewEnvClient instantiates a new Docker wrapper

func (*Docker) ComposeIsAuthorized added in v0.12.0

func (d *Docker) ComposeIsAuthorized(compose *composetypes.Config) bool

ComposeIsAuthorized checks if the given compose file is authorized

func (*Docker) ComposeParse added in v0.12.0

func (d *Docker) ComposeParse(ctx context.Context, composeFile []byte, environment []string) (*composetypes.Config, error)

ComposeParse parses a compose file

func (*Docker) ConfigExists added in v0.16.0

func (d *Docker) ConfigExists(name string) (bool, error)

func (*Docker) Connect

func (d *Docker) Connect() (err error)

Connect to the docker API

func (*Docker) CreateConfig added in v0.16.0

func (d *Docker) CreateConfig(name string, data []byte) (string, error)

func (*Docker) CreateNetwork added in v0.16.0

func (d *Docker) CreateNetwork(name string, overlay bool, attachable bool, subnets []string) (string, error)

func (*Docker) CreateSecret added in v0.16.0

func (d *Docker) CreateSecret(name string, data []byte) (string, error)

func (*Docker) ExpectedNumberOfTasks added in v0.12.0

func (d *Docker) ExpectedNumberOfTasks(ctx context.Context, serviceID string) (int32, error)

ExpectedNumberOfTasks returns expected number of tasks of a service

func (*Docker) GetClient

func (d *Docker) GetClient() *docker.Client

GetClient returns the native docker client

func (*Docker) ListConfigs added in v0.16.0

func (d *Docker) ListConfigs() ([]swarm.Config, error)

func (*Docker) ListNetworks added in v0.16.0

func (d *Docker) ListNetworks() ([]types.NetworkResource, error)

func (*Docker) ListSecrets added in v0.16.0

func (d *Docker) ListSecrets() ([]swarm.Secret, error)

func (*Docker) ListVolumes added in v0.16.0

func (d *Docker) ListVolumes(filter opts.FilterOpt) ([]*types.Volume, error)

func (*Docker) NetworkExists added in v0.16.0

func (d *Docker) NetworkExists(name string) (bool, error)

func (*Docker) NetworkID added in v0.17.0

func (d *Docker) NetworkID(name string) (string, error)

func (*Docker) NodeInspect added in v0.12.0

func (d *Docker) NodeInspect(ctx context.Context, nodeID string) (swarm.Node, error)

NodeInspect inspects a node

func (*Docker) NodeList added in v0.11.0

func (d *Docker) NodeList(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error)

NodeList list the nodes

func (*Docker) RemoveNetwork added in v0.16.0

func (d *Docker) RemoveNetwork(name string) error

func (*Docker) RemoveVolume added in v0.16.0

func (d *Docker) RemoveVolume(name string, force bool, retries int) error

func (*Docker) SecretExists added in v0.16.0

func (d *Docker) SecretExists(name string) (bool, error)

func (*Docker) ServiceInspect added in v0.12.0

func (d *Docker) ServiceInspect(ctx context.Context, service string) (swarm.Service, error)

ServiceInspect inspects a service

func (*Docker) ServiceScale added in v0.12.0

func (d *Docker) ServiceScale(ctx context.Context, service string, scale uint64) error

ServiceScale scales a service

func (*Docker) ServiceStatus added in v0.12.0

func (d *Docker) ServiceStatus(ctx context.Context, service *swarm.Service) (*ServiceStatus, error)

ServiceStatus returns service status

func (*Docker) ServicesList added in v0.12.0

func (d *Docker) ServicesList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)

ServiceList list the services

func (*Docker) StackDeploy added in v0.9.1

func (d *Docker) StackDeploy(ctx context.Context, stackName string, composeFile []byte, configFile []byte, environment []string) (output string, err error)

StackDeploy deploys a stack

func (*Docker) StackList added in v0.9.1

func (d *Docker) StackList(ctx context.Context) (output string, err error)

StackList list the stacks

func (*Docker) StackRemove added in v0.9.1

func (d *Docker) StackRemove(ctx context.Context, stackName string) (output string, err error)

StackRemove remove a stack

func (*Docker) StackServices added in v0.11.0

func (d *Docker) StackServices(ctx context.Context, stackName string, quiet bool) (output string, err error)

StackServices list the services of a stack

func (*Docker) StackStatus added in v0.12.0

func (d *Docker) StackStatus(ctx context.Context, stackName string) (*StackStatus, error)

StackStatus returns stack status

func (*Docker) TaskList added in v0.10.0

func (d *Docker) TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error)

TaskList list the tasks

func (*Docker) WaitOnService added in v0.16.0

func (d *Docker) WaitOnService(ctx context.Context, serviceID string, quiet bool) error

WaitOnService waits for the service to converge. It outputs a progress bar,

func (*Docker) WaitOnStack added in v0.16.0

func (d *Docker) WaitOnStack(ctx context.Context, namespace string, progressWriter io.Writer) []error

waitOnService waits for the service to converge. It outputs a progress bar, if appropriate based on the CLI flags.

type ServiceStatus added in v0.12.0

type ServiceStatus struct {
	RunningTasks   int32
	CompletedTasks int32
	FailedTasks    int32
	TotalTasks     int32
	Status         string
}

type StackStatus added in v0.12.0

type StackStatus struct {
	RunningServices   int32
	TotalServices     int32
	Status            string
	CompleteServices  int32
	PreparingServices int32
}

type TasksBySlot added in v0.16.0

type TasksBySlot []swarm.Task

func (TasksBySlot) Len added in v0.16.0

func (t TasksBySlot) Len() int

func (TasksBySlot) Less added in v0.16.0

func (t TasksBySlot) Less(i, j int) bool

func (TasksBySlot) Swap added in v0.16.0

func (t TasksBySlot) Swap(i, j int)

Jump to

Keyboard shortcuts

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