docker

package
v0.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

Agent is a Docker client for performing operations that interact with the Docker engine over REST

func NewAgentFromEnv

func NewAgentFromEnv() (*Agent, error)

NewAgentFromEnv creates a new Docker agent using the environment variables set on the host

func (*Agent) ConnectContainerToNetwork

func (a *Agent) ConnectContainerToNetwork(networkID, containerID, containerName string) error

ConnectContainerToNetwork attaches a container to a specified network

func (*Agent) CreateBridgeNetwork

func (a *Agent) CreateBridgeNetwork(name string) (id string, err error)

CreateBridgeNetwork creates a volume using the default driver type (bridge) with the CLI label attached

func (*Agent) CreateBridgeNetworkIfNotExist

func (a *Agent) CreateBridgeNetworkIfNotExist(name string) (id string, err error)

CreateBridgeNetworkIfNotExist creates a volume using driver type "local" with the given name if it does not exist. If the volume does exist but does not contain the required label (a.label), an error is thrown.

func (*Agent) CreateLocalVolume

func (a *Agent) CreateLocalVolume(name string) (*types.Volume, error)

CreateLocalVolume creates a volume using driver type "local" with no configured options. The equivalent of:

docker volume create --driver local [name]

func (*Agent) CreateLocalVolumeIfNotExist

func (a *Agent) CreateLocalVolumeIfNotExist(name string) (*types.Volume, error)

CreateLocalVolumeIfNotExist creates a volume using driver type "local" with the given name if it does not exist. If the volume does exist but does not contain the required label (a.label), an error is thrown.

func (*Agent) PullImage

func (a *Agent) PullImage(image string) error

PullImage pulls an image specified by the image string

func (*Agent) StartPorterContainer

func (a *Agent) StartPorterContainer(opts PorterStartOpts) (string, error)

StartPorterContainer pulls a specific Porter image and starts a container using the Docker engine. It returns the container ID

func (*Agent) StartPostgresContainer

func (a *Agent) StartPostgresContainer(opts PostgresOpts) (string, error)

StartPostgresContainer pulls a specific Porter image and starts a container using the Docker engine

func (*Agent) StopPorterContainers

func (a *Agent) StopPorterContainers() error

StopPorterContainers finds all containers that were started via the CLI and stops them without removal.

func (*Agent) WaitForContainerHealthy

func (a *Agent) WaitForContainerHealthy(id string, streak int) error

WaitForContainerHealthy waits until a container is returning a healthy status. Streak is the maximum number of failures in a row, while timeout is the length of time between checks.

func (*Agent) WaitForContainerStop

func (a *Agent) WaitForContainerStop(id string) error

WaitForContainerStop waits until a container has stopped to exit

type PorterStartOpts

type PorterStartOpts struct {
	Name          string
	Image         string
	StartCmd      []string
	HostPort      uint
	ContainerPort uint
	Mounts        []mount.Mount
	VolumeMap     map[string]struct{}
	Env           []string
	NetworkID     string
}

PorterStartOpts are the options for starting the Porter container

type PostgresOpts

type PostgresOpts struct {
	Name      string
	Image     string
	Env       []string
	VolumeMap map[string]struct{}
	Mounts    []mount.Mount
	NetworkID string
}

PostgresOpts are the options for starting the Postgres DB

type PullImageEvent

type PullImageEvent struct {
	Status         string `json:"status"`
	Error          string `json:"error"`
	Progress       string `json:"progress"`
	ProgressDetail struct {
		Current int `json:"current"`
		Total   int `json:"total"`
	} `json:"progressDetail"`
}

PullImageEvent represents a response from the Docker API with an image pull event

Jump to

Keyboard shortcuts

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