dckr

package
v1.0.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2017 License: GPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoSuchVolume = docker.ErrNoSuchVolume

NoSuchVolume is an error that occurs when a volume is not found

View Source
var NodeAlreadyInSwarm = docker.ErrNodeAlreadyInSwarm

NodeAlreadyInSwarm is an error that occurs when we try to switch to the swarm mode but the node is already in a swarm

View Source
var NodeNotInSwarm = docker.ErrNodeNotInSwarm

NodeNotInSwarm is an error that occurs when we try to switch to the swarm mode but the node is cannot do it

View Source
var VolumeInUse = docker.ErrVolumeInUse

VolumeInUse is an error that occurs when a volume is in use

Functions

This section is empty.

Types

type Client

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

Client a Docker client with easy to use API

func NewClient

func NewClient(dcfg def.DockerConfig) (Client, error)

NewClient returns a new docker client or an error

func NewClientFirstOf

func NewClientFirstOf(cfg []def.DockerConfig) (Client, error)

NewClientFirstOf returns a new docker client or an error

func (*Client) BuildImage

func (c *Client) BuildImage(dirpath string) (Image, error)

BuildImage builds a Docker image from a directory with a Dockerfile

func (Client) CreateSwarmService

func (c Client) CreateSwarmService(repoTag string, cmdArgs []string, binds []VolBind, limits def.LimitConfig, timeouts def.TimeoutConfig) (*swarm.Service, *bytes.Buffer, error)

CreateSwarmService creates a Docker swarm service

func (Client) DeleteImage

func (c Client) DeleteImage(id string) error

DeleteImage removes an image by ID

func (Client) ExecuteImage

func (c Client) ExecuteImage(imgID string, imgRepoTag string, cmdArgs []string, binds []VolBind, limits def.LimitConfig, timeouts def.TimeoutConfig, removeOnExit bool) (ContainerID, string, int, *bytes.Buffer, error)

ExecuteImage takes a docker image, creates a container and executes it, and waits for it to end

func (Client) GetSwarmContainerInfo

func (c Client) GetSwarmContainerInfo(serviceID string) (string, swarm.TaskState, error)

GetSwarmContainerInfo finds a task associated with the given serviceID and retrieves information about the corresponding container

func (Client) GetTarStream

func (c Client) GetTarStream(containerID, filePath string) (io.Reader, error)

GetTarStream returns a reader with a tar stream of a file path in a container

func (*Client) ImportImageFromTar

func (c *Client) ImportImageFromTar(imageFilePath string) (ImageID, error)

ImportImageFromTar installs a docker tar file as a docker image

func (Client) InitiateSwarmMode

func (c Client) InitiateSwarmMode(listenAddr string, advertiseAddr string) (string, error)

InitiateSwarmMode switches a node to the Swarm Mode

func (Client) InspectContainer

func (c Client) InspectContainer(id ContainerID) (Container, error)

InspectContainer returns the container details

func (Client) InspectImage

func (c Client) InspectImage(id ImageID) (Image, error)

InspectImage returns the image stats

func (Client) IsSwarmActive

func (c Client) IsSwarmActive() (bool, error)

IsSwarmActive checks if the Swarm Mode is active

func (Client) IsValid

func (c Client) IsValid() bool

IsValid returns true if the client is connected

func (Client) LeaveIfInSwarmMode

func (c Client) LeaveIfInSwarmMode() error

LeaveIfInSwarmMode deactivates the Swarm Mode, if it was on

func (Client) LeaveSwarmMode

func (c Client) LeaveSwarmMode(forced bool) error

LeaveSwarmMode deactivates the Swarm Mode

func (Client) ListContainers

func (c Client) ListContainers() ([]Container, error)

ListContainers lists the docker images

func (Client) ListImages

func (c Client) ListImages() ([]Image, error)

ListImages lists the docker images

func (Client) ListVolumes

func (c Client) ListVolumes() ([]Volume, error)

ListVolumes list all named volumes

func (*Client) NewVolume

func (c *Client) NewVolume() (Volume, error)

NewVolume builds an empty Docker volume

func (Client) RemoveVolume

func (c Client) RemoveVolume(id VolumeID) error

RemoveVolume removes a volume

func (Client) StartImage

func (c Client) StartImage(id string, repoTag string, cmdArgs []string, binds []VolBind, limits def.LimitConfig, timeouts def.TimeoutConfig) (ContainerID, *bytes.Buffer, error)

StartImage takes a docker image, creates a container and starts it

func (Client) StartImageOrSwarmService

func (c Client) StartImageOrSwarmService(imgID string, imgRepoTag string, cmdArgs []string, binds []VolBind, limits def.LimitConfig, timeouts def.TimeoutConfig) (ContainerID, string, *bytes.Buffer, error)

StartImageOrSwarmService

func (Client) StartSwarmService

func (c Client) StartSwarmService(id string, repoTag string, cmdArgs []string, binds []VolBind, limits def.LimitConfig, timeouts def.TimeoutConfig) (ContainerID, string, *bytes.Buffer, error)

StartSwarmService

func (*Client) TagImage

func (c *Client) TagImage(id string, repo string, tag string) error

TagImage tags a docker image

func (Client) TerminateContainerOrSwarmService

func (c Client) TerminateContainerOrSwarmService(containerID string, swarmServiceID string) error

TerminateContainerOrSwarmService removes a container or a swarm service

func (Client) ToggleSwarmMode

func (c Client) ToggleSwarmMode(listenAddr string, advertiseAddr string) (string, error)

InitiateOrLeaveSwarmMode switches a node to the Swarm Mode, if it was off and vice versa

func (Client) UploadFile2Container

func (c Client) UploadFile2Container(containerID, srcPath string, dstPath string) error

UploadFile2Container exported

func (Client) WaitContainerOrSwarmService

func (c Client) WaitContainerOrSwarmService(containerID string) (int, error)

WaitContainerOrSwarmService takes a docker container/swarm service id, monitors it and waits for it to finish. An exit code of the container/swarm service is returned.

type Container

type Container struct {
	ID     ContainerID
	Image  Image
	State  docker.State
	Mounts []docker.Mount
}

Container is a struct for Docker containers

type ContainerID

type ContainerID string

ContainerID is a type for docker image ids

type Image

type Image struct {
	ID      ImageID
	RepoTag string
	Labels  map[string]string
	Created time.Time
	Size    int64
	Cmd     []string
}

Image is a struct for Docker images

type ImageID

type ImageID string

ImageID is a type for docker image ids

type VolBind

type VolBind struct {
	VolumeID   VolumeID
	MountPoint string
	IsReadOnly bool
}

VolBind is a binding between a Docker volume and a mounting path

func NewVolBind

func NewVolBind(id VolumeID, mount string, readonly bool) VolBind

NewVolBind creates a new VolBind

type Volume

type Volume struct {
	ID VolumeID
}

Volume is a struct for Docker volumes

type VolumeID

type VolumeID string

VolumeID is a type for docker volume ids

type WriteMonitor

type WriteMonitor struct{ io.Writer }

WriteMonitor used to keep console output

func (*WriteMonitor) Write

func (w *WriteMonitor) Write(bs []byte) (int, error)

Jump to

Keyboard shortcuts

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