containers

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: Apache-2.0 Imports: 27 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLostSync = errors.New("lost synchronization with multiplexed stream")
)

Functions

func Attach

func Attach(ctx context.Context, nameOrID string, detachKeys *string, logs, stream *bool, stdin io.Reader, stdout io.Writer, stderr io.Writer, attachReady chan bool) error

Attach attaches to a running container

func Checkpoint

func Checkpoint(ctx context.Context, nameOrID string, keep, leaveRunning, tcpEstablished, ignoreRootFS *bool, export *string) (*entities.CheckpointReport, error)

Checkpoint checkpoints the given container (identified by nameOrID). All additional options are options and allow for more fine grained control of the checkpoint process.

func Commit

func Commit(ctx context.Context, nameOrID string, options CommitOptions) (handlers.IDResponse, error)

Commit creates a container image from a container. The container is defined by nameOrID. Use the CommitOptions for finer grain control on characteristics of the resulting image.

func ContainerInit

func ContainerInit(ctx context.Context, nameOrID string) error

ContainerInit takes a created container and executes all of the preparations to run the container except it will not start or attach to the container

func DemuxFrame

func DemuxFrame(r io.Reader, buffer []byte, length int) (frame []byte, err error)

DemuxFrame reads contents for frame from server multiplexed stdin/stdout/stderr/2nd error channel

func DemuxHeader

func DemuxHeader(r io.Reader, buffer []byte) (fd, sz int, err error)

DemuxHeader reads header for stream from server multiplexed stdin/stdout/stderr/2nd error channel

func Diff

func Diff(ctx context.Context, nameOrID string) ([]archive.Change, error)

Diff provides the changes between two container layers

func ExecCreate

func ExecCreate(ctx context.Context, nameOrID string, config *handlers.ExecCreateConfig) (string, error)

ExecCreate creates a new exec session in an existing container. The exec session will not be started; that is done with ExecStart. Returns ID of new exec session, or an error if one occurred.

func ExecInspect

func ExecInspect(ctx context.Context, sessionID string) (*define.InspectExecSession, error)

ExecInspect inspects an existing exec session, returning detailed information about it.

func ExecStart

func ExecStart(ctx context.Context, sessionID string) error

ExecStart starts (but does not attach to) a given exec session.

func ExecStartAndAttach

func ExecStartAndAttach(ctx context.Context, sessionID string, streams *define.AttachStreams) error

ExecStartAndAttach starts and attaches to a given exec session.

func Exists

func Exists(ctx context.Context, nameOrID string, external bool) (bool, error)

Exists is a quick, light-weight way to determine if a given container exists in local storage. The nameOrID can be a container name or a partial/full ID.

func Export

func Export(ctx context.Context, nameOrID string, w io.Writer) error

Export creates a tarball of the given name or ID of a container. It requires an io.Writer be provided to write the tarball.

func GetMountedContainerPaths

func GetMountedContainerPaths(ctx context.Context) (map[string]string, error)

GetMountedContainerPaths returns a map of mounted containers and their mount locations.

func Inspect

func Inspect(ctx context.Context, nameOrID string, size *bool) (*define.InspectContainerData, error)

Inspect returns low level information about a Container. The nameOrID can be a container name or a partial/full ID. The size bool determines whether the size of the container's root filesystem should be calculated. Calculating the size of a container requires extra work from the filesystem and is therefore slower.

func Kill

func Kill(ctx context.Context, nameOrID string, sig string) error

Kill sends a given signal to a given container. The signal should be the string representation of a signal like 'SIGKILL'. The nameOrID can be a container name or a partial/full ID

func List

func List(ctx context.Context, filters map[string][]string, all *bool, last *int, namespace, size, sync *bool) ([]entities.ListContainer, error)

List obtains a list of containers in local storage. All parameters to this method are optional. The filters are used to determine which containers are listed. The last parameter indicates to only return the most recent number of containers. The pod and size booleans indicate that pod information and rootfs size information should also be included. Finally, the sync bool synchronizes the OCI runtime and container state.

func Logs

func Logs(ctx context.Context, nameOrID string, opts LogOptions, stdoutChan, stderrChan chan string) error

Logs obtains a container's logs given the options provided. The logs are then sent to the stdout|stderr channels as strings.

func Mount

func Mount(ctx context.Context, nameOrID string) (string, error)

Mount mounts an existing container to the filesystem. It returns the path of the mounted container in string format.

func Pause

func Pause(ctx context.Context, nameOrID string) error

Pause pauses a given container. The nameOrID can be a container name or a partial/full ID.

func Prune

func Prune(ctx context.Context, filters map[string][]string) (*entities.ContainerPruneReport, error)

Prune removes stopped and exited containers from local storage. The optional filters can be used for more granular selection of containers. The main error returned indicates if there were runtime errors like finding containers. Errors specific to the removal of a container are in the PruneContainerResponse structure.

func Remove

func Remove(ctx context.Context, nameOrID string, force, volumes *bool) error

Remove removes a container from local storage. The force bool designates that the container should be removed forcibly (example, even it is running). The volumes bool dictates that a container's volumes should also be removed.

func ResizeContainerTTY

func ResizeContainerTTY(ctx context.Context, nameOrID string, height *int, width *int) error

ResizeContainerTTY sets container's TTY height and width in characters

func ResizeExecTTY

func ResizeExecTTY(ctx context.Context, nameOrID string, height *int, width *int) error

ResizeExecTTY sets session's TTY height and width in characters

func Restart

func Restart(ctx context.Context, nameOrID string, timeout *int) error

Restart restarts a running container. The nameOrID can be a container name or a partial/full ID. The optional timeout specifies the number of seconds to wait for the running container to stop before killing it.

func Restore

func Restore(ctx context.Context, nameOrID string, keep, tcpEstablished, ignoreRootFS, ignoreStaticIP, ignoreStaticMAC *bool, name, importArchive *string) (*entities.RestoreReport, error)

Restore restores a checkpointed container to running. The container is identified by the nameOrID option. All additional options are optional and allow finer control of the restore process.

func RunHealthCheck

func RunHealthCheck(ctx context.Context, nameOrID string) (*define.HealthCheckResults, error)

RunHealthCheck executes the container's healthcheck and returns the health status of the container.

func ShouldRestart added in v2.2.0

func ShouldRestart(ctx context.Context, nameOrID string) (bool, error)

func Start

func Start(ctx context.Context, nameOrID string, detachKeys *string) error

Start starts a non-running container.The nameOrID can be a container name or a partial/full ID. The optional parameter for detach keys are to override the default detach key sequence.

func Stats

func Stats(ctx context.Context, containers []string, stream *bool) (chan entities.ContainerStatsReport, error)

func Stop

func Stop(ctx context.Context, nameOrID string, timeout *uint) error

Stop stops a running container. The timeout is optional. The nameOrID can be a container name or a partial/full ID

func Top

func Top(ctx context.Context, nameOrID string, descriptors []string) ([]string, error)

Top gathers statistics about the running processes in a container. The nameOrID can be a container name or a partial/full ID. The descriptors allow for specifying which data to collect from the process.

func Unmount

func Unmount(ctx context.Context, nameOrID string) error

Unmount unmounts a container from the filesystem. The container must not be running or the unmount will fail.

func Unpause

func Unpause(ctx context.Context, nameOrID string) error

Unpause resumes the given paused container. The nameOrID can be a container name or a partial/full ID.

func Wait

func Wait(ctx context.Context, nameOrID string, condition *define.ContainerStatus) (int32, error)

Wait blocks until the given container reaches a condition. If not provided, the condition will default to stopped. If the condition is stopped, an exit code for the container will be provided. The nameOrID can be a container name or a partial/full ID.

Types

type CommitOptions

type CommitOptions struct {
	Author  *string
	Changes []string
	Comment *string
	Format  *string
	Pause   *bool
	Repo    *string
	Tag     *string
}

CommitOptions describe details about the resulting committed image as defined by repo and tag. None of these options are required.

type LogOptions

type LogOptions struct {
	Follow     *bool
	Since      *string
	Stderr     *bool
	Stdout     *bool
	Tail       *string
	Timestamps *bool
	Until      *string
}

LogOptions describe finer control of log content or how the content is formatted.

Jump to

Keyboard shortcuts

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