docker

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package docker providers an implementation of a Driver driver for job execution. Each job executed will be done in a separate container, a volume is used to persist state across these containers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(w io.Writer, cfg driver.Config) runner.Driver

Init initializes a new driver for Docker using the given io.Writer, and applying the given driver.Config.

Types

type Config

type Config struct {
	Host      string // The host running the Docker daemon.
	Version   string // The version of the Docker API.
	Image     string // The container image to use.
	Workspace string // The workspace in the container to mount the volume to.
}

Config is the struct used for initializing a new Docker driver for build execution.

func (*Config) Apply

func (cfg *Config) Apply(d runner.Driver)

func (*Config) Merge

func (cfg *Config) Merge(m map[string]string) driver.Config

type Driver

type Driver struct {
	io.Writer

	Host    string // Host is the host of the Docker registry to use.
	Version string // Version is the Docker API version to use.
	Image   string // Image is the name of the image to use in the Docker container.

	// Workspace specifies location on the Driver container to mount a volume
	// to so state can be persisted.
	Workspace string
	// contains filtered or unexported fields
}

Driver provides an implementation of the runner.Dirver interface for running jobs within a Docker container.

func (*Driver) Create

func (d *Driver) Create(c context.Context, env []string, objs runner.Passthrough, p runner.Placer) error

Create will create a volume, and pull down the configured image. The client to the Driver daemon is derived from the environment. Once the client has been established, the image volume is created, and the image is pulled down from the repository.

func (*Driver) Destroy

func (d *Driver) Destroy()

Destroy will remove all containers created during job execution, and the volume. All of these operations are forced.

func (*Driver) Execute

func (d *Driver) Execute(j *runner.Job, c runner.Collector)

Execute performs the given runner.Job in a Driver container. Each job is turned into a shell script and placed onto an initial container. A subsequent container is then created, and the previously placed script is used as that new container's entrypoint. The logs for the container are forwarded to the underlying io.Writer.

Jump to

Keyboard shortcuts

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