libcontainerd

package
v1.13.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2017 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateStart       = "start-container"
	StatePause       = "pause"
	StateResume      = "resume"
	StateExit        = "exit"
	StateRestore     = "restore"
	StateExitProcess = "exit-process"
	StateOOM         = "oom" // fake state
)

State constants used in state change reporting.

View Source
const (
	// InitFriendlyName is the name given in the lookup map of processes
	// for the first process started in a container.
	InitFriendlyName = "init"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	StateChanged(containerID string, state StateInfo) error
}

Backend defines callbacks that the client of the library needs to implement.

type Checkpoints added in v1.13.0

Checkpoints contains the details of a checkpoint

type Client

type Client interface {
	GetServerVersion(ctx context.Context) (*ServerVersion, error)
	Create(containerID string, checkpoint string, checkpointDir string, spec specs.Spec, attachStdio StdioCallback, options ...CreateOption) error
	Signal(containerID string, sig int) error
	SignalProcess(containerID string, processFriendlyName string, sig int) error
	AddProcess(ctx context.Context, containerID, processFriendlyName string, process Process, attachStdio StdioCallback) (int, error)
	Resize(containerID, processFriendlyName string, width, height int) error
	Pause(containerID string) error
	Resume(containerID string) error
	Restore(containerID string, attachStdio StdioCallback, options ...CreateOption) error
	Stats(containerID string) (*Stats, error)
	GetPidsForContainer(containerID string) ([]int, error)
	Summary(containerID string) ([]Summary, error)
	UpdateResources(containerID string, resources Resources) error
	CreateCheckpoint(containerID string, checkpointID string, checkpointDir string, exit bool) error
	DeleteCheckpoint(containerID string, checkpointID string, checkpointDir string) error
	ListCheckpoints(containerID string, checkpointDir string) (*Checkpoints, error)
}

Client provides access to containerd features.

type CommonStateInfo added in v1.12.0

type CommonStateInfo struct {
	State     string
	Pid       uint32
	ExitCode  uint32
	ProcessID string
}

CommonStateInfo contains the state info common to all platforms.

type CreateOption

type CreateOption interface {
	Apply(interface{}) error
}

CreateOption allows to configure parameters of container creation.

func WithRuntime added in v1.12.0

func WithRuntime(path string, args []string) CreateOption

WithRuntime sets the runtime to be used for the created container

type IOPipe

type IOPipe struct {
	Stdin    io.WriteCloser
	Stdout   io.ReadCloser
	Stderr   io.ReadCloser
	Terminal bool // Whether stderr is connected on Windows
}

IOPipe contains the stdio streams.

type Process

type Process struct {
	// Terminal creates an interactive terminal for the container.
	Terminal bool `json:"terminal"`
	// User specifies user information for the process.
	User *specs.User `json:"user"`
	// Args specifies the binary and arguments for the application to execute.
	Args []string `json:"args"`
	// Env populates the process environment for the process.
	Env []string `json:"env,omitempty"`
	// Cwd is the current working directory for the process and must be
	// relative to the container's root.
	Cwd *string `json:"cwd"`
	// Capabilities are linux capabilities that are kept for the container.
	Capabilities []string `json:"capabilities,omitempty"`
	// Rlimits specifies rlimit options to apply to the process.
	Rlimits []specs.Rlimit `json:"rlimits,omitempty"`
	// ApparmorProfile specifies the apparmor profile for the container.
	ApparmorProfile *string `json:"apparmorProfile,omitempty"`
	// SelinuxLabel specifies the selinux context that the container process is run as.
	SelinuxLabel *string `json:"selinuxLabel,omitempty"`
}

Process contains information to start a specific application inside the container.

type Remote

type Remote interface {
	// Client returns a new Client instance connected with given Backend.
	Client(Backend) (Client, error)
	// Cleanup stops containerd if it was started by libcontainerd.
	// Note this is not used on Windows as there is no remote containerd.
	Cleanup()
	// UpdateOptions allows various remote options to be updated at runtime.
	UpdateOptions(...RemoteOption) error
}

Remote on Linux defines the accesspoint to the containerd grpc API. Remote on Windows is largely an unimplemented interface as there is no remote containerd.

func New

func New(stateDir string, options ...RemoteOption) (_ Remote, err error)

New creates a fresh instance of libcontainerd remote.

type RemoteOption

type RemoteOption interface {
	Apply(Remote) error
}

RemoteOption allows to configure parameters of remotes. This is unused on Windows.

func WithDebugLog

func WithDebugLog(debug bool) RemoteOption

WithDebugLog defines if containerd debug logs will be enabled for daemon.

func WithLiveRestore added in v1.12.0

func WithLiveRestore(v bool) RemoteOption

WithLiveRestore defines if containers are stopped on shutdown or restored.

func WithOOMScore added in v1.12.0

func WithOOMScore(score int) RemoteOption

WithOOMScore defines the oom_score_adj to set for the containerd process.

func WithRemoteAddr

func WithRemoteAddr(addr string) RemoteOption

WithRemoteAddr sets the external containerd socket to connect to.

func WithRuntimeArgs

func WithRuntimeArgs(args []string) RemoteOption

WithRuntimeArgs sets the list of runtime args passed to containerd

func WithRuntimePath added in v1.12.0

func WithRuntimePath(rt string) RemoteOption

WithRuntimePath sets the path of the runtime to be used as the default by containerd

func WithStartDaemon

func WithStartDaemon(start bool) RemoteOption

WithStartDaemon defines if libcontainerd should also run containerd daemon.

type Resources

type Resources containerd.UpdateResource

Resources defines updatable container resource values.

type ServerVersion added in v1.13.0

type ServerVersion struct {
	containerd.GetServerVersionResponse
}

ServerVersion contains version information as retrieved from the server

type StateInfo

type StateInfo struct {
	CommonStateInfo

	// Platform specific StateInfo
	OOMKilled bool
}

StateInfo contains description about the new state container has entered.

type Stats

Stats contains a stats properties from containerd.

type StdioCallback added in v1.12.4

type StdioCallback func(IOPipe) error

StdioCallback is called to connect a container or process stdio.

type Summary

type Summary struct{}

Summary contains a container summary from containerd

Jump to

Keyboard shortcuts

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