Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) BuildImage(dirpath string) (Image, error)
- func (c Client) CreateSwarmService(repoTag string, cmdArgs []string, binds []VolBind, limits def.LimitConfig, ...) (*swarm.Service, *bytes.Buffer, error)
- func (c Client) DeleteImage(id string) error
- func (c Client) ExecuteImage(imgID string, imgRepoTag string, cmdArgs []string, binds []VolBind, ...) (ContainerID, string, int, *bytes.Buffer, error)
- func (c Client) GetSwarmContainerInfo(serviceID string) (string, swarm.TaskState, error)
- func (c Client) GetTarStream(containerID, filePath string) (io.Reader, error)
- func (c *Client) ImportImageFromTar(imageFilePath string) (ImageID, error)
- func (c Client) InitiateSwarmMode(listenAddr string, advertiseAddr string) (string, error)
- func (c Client) InspectContainer(id ContainerID) (Container, error)
- func (c Client) InspectImage(id ImageID) (Image, error)
- func (c Client) IsSwarmActive() (bool, error)
- func (c Client) IsValid() bool
- func (c Client) LeaveIfInSwarmMode() error
- func (c Client) LeaveSwarmMode(forced bool) error
- func (c Client) ListContainers() ([]Container, error)
- func (c Client) ListImages() ([]Image, error)
- func (c Client) ListVolumes() ([]Volume, error)
- func (c *Client) NewVolume() (Volume, error)
- func (c Client) RemoveVolume(id VolumeID) error
- func (c Client) StartImage(id string, repoTag string, cmdArgs []string, binds []VolBind, ...) (ContainerID, *bytes.Buffer, error)
- func (c Client) StartImageOrSwarmService(imgID string, imgRepoTag string, cmdArgs []string, binds []VolBind, ...) (ContainerID, string, *bytes.Buffer, error)
- func (c Client) StartSwarmService(id string, repoTag string, cmdArgs []string, binds []VolBind, ...) (ContainerID, string, *bytes.Buffer, error)
- func (c *Client) TagImage(id string, repo string, tag string) error
- func (c Client) TerminateContainerOrSwarmService(containerID string, swarmServiceID string) error
- func (c Client) ToggleSwarmMode(listenAddr string, advertiseAddr string) (string, error)
- func (c Client) UploadFile2Container(containerID, srcPath string, dstPath string) error
- func (c Client) WaitContainerOrSwarmService(containerID string) (int, error)
- type Container
- type ContainerID
- type Image
- type ImageID
- type VolBind
- type Volume
- type VolumeID
- type WriteMonitor
Constants ¶
This section is empty.
Variables ¶
var NoSuchVolume = docker.ErrNoSuchVolume
NoSuchVolume is an error that occurs when a volume is not found
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
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
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 ¶
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 ¶
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 ¶
GetSwarmContainerInfo finds a task associated with the given serviceID and retrieves information about the corresponding container
func (Client) GetTarStream ¶
GetTarStream returns a reader with a tar stream of a file path in a container
func (*Client) ImportImageFromTar ¶
ImportImageFromTar installs a docker tar file as a docker image
func (Client) InitiateSwarmMode ¶
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 ¶
InspectImage returns the image stats
func (Client) IsSwarmActive ¶
IsSwarmActive checks if the Swarm Mode is active
func (Client) LeaveIfInSwarmMode ¶
LeaveIfInSwarmMode deactivates the Swarm Mode, if it was on
func (Client) LeaveSwarmMode ¶
LeaveSwarmMode deactivates the Swarm Mode
func (Client) ListContainers ¶
ListContainers lists the docker images
func (Client) ListImages ¶
ListImages lists the docker images
func (Client) ListVolumes ¶
ListVolumes list all named volumes
func (Client) RemoveVolume ¶
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) TerminateContainerOrSwarmService ¶
TerminateContainerOrSwarmService removes a container or a swarm service
func (Client) ToggleSwarmMode ¶
InitiateOrLeaveSwarmMode switches a node to the Swarm Mode, if it was off and vice versa
func (Client) UploadFile2Container ¶
UploadFile2Container exported
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 WriteMonitor ¶
WriteMonitor used to keep console output