docker

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildContainerLogChannel

func BuildContainerLogChannel(ctx context.Context, client *client.Client, containerID string) (<-chan string, error)

BuildContainerLogChannel accepts a pointer to a Docker client.Client and a container ID and returns a string channel that provides all events from the container's standard output and error streams.

func BuildContainerLogChannels

func BuildContainerLogChannels(ctx context.Context, client *client.Client, containerID string) (stdout, stderr <-chan string, err error)

BuildContainerLogChannels accepts a pointer to a Docker client.Client and a container ID and returns tww string channels, one that provides all events emitted by the container's standard output stream, and a second for standard error.

Types

type ContainerWorker

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

Worker represents a container executor. It has a lifetime of a single command execution.

func New

func New(command data.CommandRequest, token rest.Token) (*ContainerWorker, error)

New will build and returns a new Worker for a single command execution.

func (*ContainerWorker) Start

func (w *ContainerWorker) Start(ctx context.Context) (<-chan string, error)

Start triggers a worker to run a container according to its settings. It returns a string channel that emits the container's combined stdout and stderr streams.

func (*ContainerWorker) Stop

func (w *ContainerWorker) Stop(ctx context.Context, timeout *time.Duration)

Stop will stop (if it's not already stopped) a worker process and clean up any resources it's using. If the worker fails to stop gracefully within a timeframe specified by the timeout argument, it is forcefully terminated (killed). If the timeout is nil, the engine's default is used. A negative timeout indicates no timeout: no forceful termination is performed.

func (*ContainerWorker) Stopped

func (w *ContainerWorker) Stopped() <-chan int64

Stopped returns a channel that blocks until this worker's container has stopped. The value emitted is the exit status code of the underlying process.

Jump to

Keyboard shortcuts

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