container

package
v0.4.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: Apache-2.0 Imports: 11 Imported by: 8

Documentation

Overview

Package container provides an interface for interacting with Docker and potentially other container runtimes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RunContainerInput

type RunContainerInput struct {
	// Image is the name of the image to run.
	Image string
	// Network is the name of the network to connect to.
	Network string
	// User is the user name to run as.
	User string
	// Group is the user group to run as.
	Group string
	// Volumes is a collection of any volumes (docker's "-v" arg) to mount in the container.
	Volumes map[string]string
	// EnvironmentVars is a collection of name/values to pass as environment variables in the container.
	EnvironmentVars map[string]string
	// CommandArgs is the command and any additional arguments to execute in the container.
	CommandArgs []string
	// Entrypoint defines the entry point to use.
	Entrypoint []string
}

RunContainerInput holds the configuration settings for running a container.

type RuntimeInterface

type RuntimeInterface interface {
	SaveContainerImage(ctx context.Context, image, dest string) error
	PullContainerImage(ctx context.Context, image string) error
	GetHostPort(ctx context.Context, name, portAndProtocol string) (string, error)
	ExecToFile(ctx context.Context, containerName string, fileOnHost *os.File, command string, args ...string) error
	RunContainer(ctx context.Context, runConfig *RunContainerInput, output io.Writer) error
}

RuntimeInterface defines the interface for interacting with a container runtime.

func NewDockerClient

func NewDockerClient() (RuntimeInterface, error)

NewDockerClient gets a client for interacting with a Docker container runtime.

Jump to

Keyboard shortcuts

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