Documentation ¶
Overview ¶
Package docker wraps Docker Go SDK for internal usage in deber
Index ¶
- Constants
- type ContainerCreateArgs
- type ContainerExecArgs
- type Docker
- func (docker *Docker) ContainerCreate(args ContainerCreateArgs) error
- func (docker *Docker) ContainerExec(args ContainerExecArgs) error
- func (docker *Docker) ContainerExecResize(execID string, fd uintptr) error
- func (docker *Docker) ContainerList(prefix string) ([]string, error)
- func (docker *Docker) ContainerMounts(name string) ([]mount.Mount, error)
- func (docker *Docker) ContainerNetwork(name string, wantConnected bool) error
- func (docker *Docker) ContainerRemove(name string) error
- func (docker *Docker) ContainerStart(name string) error
- func (docker *Docker) ContainerStop(name string) error
- func (docker *Docker) ImageAge(name string) (time.Duration, error)
- func (docker *Docker) ImageBuild(name string, dockerFile []byte) error
- func (docker *Docker) ImageList(prefix string) ([]string, error)
- func (docker *Docker) ImageRemove(name string) error
- func (docker *Docker) IsContainerCreated(name string) (bool, error)
- func (docker *Docker) IsContainerStarted(name string) (bool, error)
- func (docker *Docker) IsContainerStopped(name string) (bool, error)
- func (docker *Docker) IsImageBuilt(name string) (bool, error)
Constants ¶
const ( // ContainerStopTimeout constant represents how long Docker Engine // will wait for container before stopping it ContainerStopTimeout = 2 // ContainerStateRunning constants defines that container is running ContainerStateRunning = "running" // ContainerStateCreated constants defines that container is created ContainerStateCreated = "created" // ContainerStateExited constants defines that container has exited ContainerStateExited = "exited" // ContainerStateRestarting constants defines that container is restarting ContainerStateRestarting = "restarting" // ContainerStatePaused constants defines that container is paused ContainerStatePaused = "paused" // ContainerStateDead constants defines that container is dead ContainerStateDead = "dead" )
const (
// APIVersion constant is the minimum supported version of Docker Engine API
APIVersion = "1.40"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerCreateArgs ¶
ContainerCreateArgs struct represents arguments passed to ContainerCreate().
type ContainerExecArgs ¶
type ContainerExecArgs struct { Interactive bool Name string Cmd string WorkDir string AsRoot bool Skip bool Network bool }
ContainerExecArgs struct represents arguments passed to ContainerExec().
type Docker ¶
type Docker struct {
// contains filtered or unexported fields
}
Docker struct represents Docker client.
func (*Docker) ContainerCreate ¶
func (docker *Docker) ContainerCreate(args ContainerCreateArgs) error
ContainerCreate function creates container.
It's up to the caller to make to-be-mounted directories on host.
func (*Docker) ContainerExec ¶
func (docker *Docker) ContainerExec(args ContainerExecArgs) error
ContainerExec function executes a command in running container.
Command is executed in bash shell by default.
Command can be executed as root.
Command can be executed interactively.
Command can be empty, in that case just bash is executed.
func (*Docker) ContainerExecResize ¶
ContainerExecResize function resizes TTY for exec process.
func (*Docker) ContainerList ¶
ContainerList returns a list of containers that match passed criteria.
func (*Docker) ContainerMounts ¶
ContainerMounts returns mounts of created container.
func (*Docker) ContainerNetwork ¶
ContainerNetwork checks if container is connected to network and then connects it or disconnects per caller request.
func (*Docker) ContainerRemove ¶
ContainerRemove function removes container, just that.
func (*Docker) ContainerStart ¶
ContainerStart function starts container, just that.
func (*Docker) ContainerStop ¶
ContainerStop function stops container, just that.
It utilizes ContainerStopTimeout constant.
func (*Docker) ImageBuild ¶
ImageBuild function build image from dockerfile and prints output to Stdout.
func (*Docker) ImageRemove ¶
ImageRemove function removes image with given name.
func (*Docker) IsContainerCreated ¶
IsContainerCreated function checks if container is created or simply just exists.
func (*Docker) IsContainerStarted ¶
IsContainerStarted function checks if container's state == ContainerStateRunning.
func (*Docker) IsContainerStopped ¶
IsContainerStopped function checks if container's state != ContainerStateRunning.