perform

package
v0.11.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2015 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrContainerExists = errors.New("container exists")
)

Functions

func ContainerExists

func ContainerExists(ops *def.Operation) (docker.APIContainers, bool)

ContainerExists returns APIContainers containers list and true if the container ops.SrvContainerName exists, otherwise false.

func ContainerRunning

func ContainerRunning(ops *def.Operation) (docker.APIContainers, bool)

ContainerExists returns APIContainers containers list and true if the container ops.SrvContainerName exists and is running, otherwise false.

func DataContainerExists

func DataContainerExists(ops *def.Operation) (docker.APIContainers, bool)

ContainerExists returns APIContainers containers list and true if the container ops.DataContainerName exists and running, otherwise false.

func DockerCreateData

func DockerCreateData(ops *def.Operation) error

DockerCreateData creates a blank data container. It returns ErrContainerExists if such a container exists or other Docker errors.

ops.DataContainerName  - data container name to be created
ops.ContainerType      - container type
ops.ContainerNumber    - container number
ops.Labels             - container creation time labels (use LoadDataDefinition)

func DockerExecData

func DockerExecData(ops *def.Operation, service *def.Service) (err error)

DockerExecData runs a data container with volumes-from field set interactively.

ops.Args         - command line parameters
ops.Interactive  - if true, set Entrypoint to ops.Args,
                   if false, set Cmd to ops.Args

See parameter description for DockerRunData.

func DockerExecService

func DockerExecService(srv *def.Service, ops *def.Operation) error

DockerExecService creates and runs a chain or a service container interactively.

ops.Args         - command line parameters
ops.Interactive  - if true, set Entrypoint to ops.Args,
                   if false, set Cmd to ops.Args

See parameter description for DockerRunService.

func DockerInspect

func DockerInspect(srv *def.Service, ops *def.Operation, field string) error

DockerInspect displays container ops.SrvContainerName data on the terminal. field can be a field name of one of `docker inspect` output or it can be either "line" to display a short info line or "all" to display everything. I DockerInspect returns Docker errors on exit in not successful.

func DockerLogs

func DockerLogs(srv *def.Service, ops *def.Operation, follow bool, tail string) error

DockerLogs displays tail number of lines of container ops.SrvContainerName output. If follow is true, it behaves like `tail -f`. It returns Docker errors on exit if not successful.

func DockerPull

func DockerPull(srv *def.Service, ops *def.Operation) error

DockerPull pulls the image for the container specified in srv.Image. DockerPull returns Docker errors on exit if not successful.

ops.SrvContainerName  - service or a chain container name
ops.ContainerNumber   - container number
ops.ContainerType     - container type
ops.Labels            - container creation time labels

Also see container parameters for DockerRunService.

func DockerRebuild

func DockerRebuild(srv *def.Service, ops *def.Operation, skipPull bool, timeout uint) error

DockerRebuild recreates the container based on the srv settings template. Unless skipPull is true, it updates the Docker image before recreating the container. timeout is a number of seconds to wait before killing the container process ungracefully.

ops.SrvContainerName  - service or a chain container name to rebuild
ops.ContainerNumber   - container number
ops.ContainerType     - container type
ops.Labels            - container creation time labels

Also see container parameters for DockerRunService.

func DockerRemove

func DockerRemove(srv *def.Service, ops *def.Operation, withData, volumes bool) error

DockerRemove removes the ops.SrvContainerName container unforcedly. If withData is true, the associated data container is also removed. If volumes is true, the associated volumes are removed for both containers. DockerRemove returns Docker errors on exit if not successful.

func DockerRename

func DockerRename(ops *def.Operation, newName string) error

DockerRename renames the container by removing and recreating it. The container is also restarted if it was running before rename. The container ops.SrvContainerName is renamed to a new name, constructed using a short given newName. DockerRename returns Docker errors on exit or ErrContainerExists if the container with the new (long) name exists.

ops.SrvContainerName  - container name
ops.ContainerNumber   - container number
ops.ContainerType     - container type
ops.Labels            - container creation time labels

func DockerRunData

func DockerRunData(ops *def.Operation, service *def.Service) (result []byte, err error)

DockerRunData runs a data container with the volumes-from option set. The container is destroyed on exit; the container log is returned as a byte stream. If service parameter is specified, the command inherits the service settings from that container.

ops.DataContainerName - container name to be mount with `--volumes-from=[]` option.
ops.ContainerType     - container type
ops.ContainerNumber   - container number
ops.Labels            - container creation time labels (use LoadDataDefinition)
ops.Args              - if specified, run these args in a container

func DockerRunService

func DockerRunService(srv *def.Service, ops *def.Operation) error

DockerRunService creates and runs a chain or a service container with the srv settings template. It also creates dependent data containers if srv.AutoData is true. DockerRunService returns Docker errors if not successful.

srv.AutoData          - if true, create or use existing data container

ops.SrvContainerName  - service or a chain container name
ops.DataContainerName - dependent data container name
ops.ContainerNumber   - container number
ops.ContainerType     - container type
ops.Labels            - container creation time labels
                        (use LoadServiceDefinition or LoadChainDefinition)

Container parameters:

ops.Remove            - remove container on exit (similar to `docker run --rm`)
ops.PublishAllPorts   - if true, publish exposed ports to random ports
ops.CapAdd            - add linux capabilities (similar to `docker run --cap-add=[]`)
ops.CapDrop           - add linux capabilities (similar to `docker run --cap-drop=[]`)
ops.Privileged        - if true, give extended privileges
ops.Restart           - container restart policy ("always", "max:<#attempts>"
                        or never if unspecified)

func DockerStop

func DockerStop(srv *def.Service, ops *def.Operation, timeout uint) error

DockerStop stops a running ops.SrvContainerName container unforcedly. timeout is a number of seconds to wait before killing the container process ungracefully. It returns Docker errors on exit if not successful. DockerStop doesn't return an error if the container isn't running.

Types

This section is empty.

Jump to

Keyboard shortcuts

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