Documentation

Index

Constants

View Source
const VolumeContainerDir = "/vol"

VolumeContainerDir is the path inside the container to the Docker volume.

Variables

This section is empty.

Functions

This section is empty.

Types

type Docker

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

Docker executes docker CLI commands to make and manage a single container.

func (*Docker) ExecCommand

func (d *Docker) ExecCommand(ctx context.Context, cmd []string) error

ExecCommand runs a command inside a running container. The container must have already been started with StartContainer().

func (*Docker) IsRunning

func (d *Docker) IsRunning() bool

IsRunning returns whether the Docker container is running.

func (*Docker) PullImage

func (d *Docker) PullImage(ctx context.Context, imageURI string) error

PullImage downloads a Docker image.

func (*Docker) RunContainer

func (d *Docker) RunContainer(ctx context.Context, imageURI, volumeHostDir string) error

RunContainer starts a Docker container process containing a new Docker volume. volumeHostDir is the path in the host filesystem that will be bound as the volume in the container, e.g. host:/tmp/dir may be bound as container:/vol

func (*Docker) StopContainer

func (d *Docker) StopContainer(ctx context.Context) error

StopContainer stops a running container.

Source Files