docker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DockerImageIDPrefix is the prefix of image id in container status.
	DockerImageIDPrefix = "docker://"
	// DockerPullableImageIDPrefix is the prefix of pullable image id in container status.
	DockerPullableImageIDPrefix = "docker-pullable://"
)

Functions

func ConnectToDockerOrDie

func ConnectToDockerOrDie()

ConnectToDockerOrDie tries to connect to the docker and prints the version

func IsContainerNotFoundError

func IsContainerNotFoundError(err error) bool

IsContainerNotFoundError checks whether the error is container not found error.

Types

type ExecHandler

ExecHandler knows how to execute a command in a running Docker container.

type ExecTimeoutError

type ExecTimeoutError struct{}

ExecTimeoutError is the error corresponding to the timeout in exec of the step.

func (*ExecTimeoutError) Error

func (d *ExecTimeoutError) Error() string

type NativeExecHandler

type NativeExecHandler struct{}

NativeExecHandler executes commands in Docker containers using Docker's exec API.

func (*NativeExecHandler) ExecInContainer

func (n *NativeExecHandler) ExecInContainer(ctx context.Context, client *dockerapi.Client,
	container *dockertypes.ContainerJSON, cmd []string,
	stdin io.Reader, stdout io.WriteCloser, stderr io.WriteCloser,
	timeout time.Duration, tty bool) (*dockertypes.ContainerExecInspect, error)

ExecInContainer executes the provided command in the container using docker client

type RuntimeExecutor

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

RuntimeExecutor contains the runtime executor for docker provider.

func NewCRE

func NewCRE() (*RuntimeExecutor, error)

NewCRE returns an instance of new docker container runtime executor.

func (*RuntimeExecutor) ContainerStatus

ContainerStatus returns status of the container. If the container is not present, returns an error.

func (*RuntimeExecutor) CreateContainer

CreateContainer creates a new container Docker cannot store the log to an arbitrary location (yet), so we create an symlink at LogPath, linking to the actual path of the log.

func (*RuntimeExecutor) ExecSync

ExecSync executes the command in the docker container

func (*RuntimeExecutor) ImageStatus

ImageStatus returns the status of the image. If the image is not present, returns a response with ImageStatusResponse.Image set to nil.

func (*RuntimeExecutor) ListContainers

ListContainers list all the containers that match the required criteria

func (*RuntimeExecutor) ListImages

ListImages lists all the images matching the criteria in ImageRequest

func (*RuntimeExecutor) PullImage

PullImage pulls an image with authentication config.

func (*RuntimeExecutor) RemoveContainer

func (e *RuntimeExecutor) RemoveContainer(ctx context.Context, r *runtime.RemoveContainerRequest) error

RemoveContainer removes a container using the docker container runtime.

func (*RuntimeExecutor) RemoveImage

RemoveImage removes the image. This call is idempotent, and must not return an error if the image has already been removed.

func (*RuntimeExecutor) StartContainer

StartContainer starts running the container in context.

func (*RuntimeExecutor) Status

Status returns the status of the underlying runtime.

func (*RuntimeExecutor) StopContainer

StopContainer stops a running container.

func (*RuntimeExecutor) Type

func (e *RuntimeExecutor) Type() string

Type returns the type of the container runtime executor, for docker this is docker.

func (*RuntimeExecutor) Version

Version returns the version information about the cotainer runtime.

Jump to

Keyboard shortcuts

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