exec

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerClient

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

DockerClient wraps a Docker client instance and provides methods to pull images and start containers.

func NewDockerClient

func NewDockerClient() (h *DockerClient, err error)

NewDockerClient creates a new DockerClient. To configure the client, use environment variables: DOCKER_HOST, DOCKER_API_VERSION, DOCKER_CERT_PATH and DOCKER_TLS_VERIFY are supported.

func (*DockerClient) Executor

func (dc *DockerClient) Executor(doc tex.Document) Exec

func (*DockerClient) Run

func (dc *DockerClient) Run(ctx context.Context, tag, wd string, cmd []string) (string, error)

Run creates a new Docker container from the given image tag, mounts the working directory into it, and executes the given command in it.

func (*DockerClient) SetImages

func (dc *DockerClient) SetImages(ctx context.Context, alwaysPull bool, tags ...string) ([]string, error)

SetImages ensures that the given image tags are present on the Docker host (missing images are pulled automatically). Existing images are not updated, unless alwaysPull is true.

If stdout is a terminal, download progress is reported.

SetImages also sets the DockerClients allow list from which containers are started.

type Exec

type Exec interface {
	Run(context.Context) error
}

func LocalExec

func LocalExec(doc tex.Document) Exec

Jump to

Keyboard shortcuts

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