Documentation
¶
Index ¶
- Constants
- func GenerateSpec(opts ...SpecOpts) (*specs.Spec, error)
- func NewRemoteContainerStore(client containersapi.ContainersClient) containers.Store
- func WithExit(r *CheckpointTaskInfo) error
- func WithPullUnpack(client *Client, c *RemoteContext) error
- func WithRootFSDeletion(ctx context.Context, client *Client, c containers.Container) error
- func WithSchema1Conversion(client *Client, c *RemoteContext) error
- func WithStdinCloser(r *IOCloseInfo)
- func WithTTY(s *specs.Spec) error
- type CheckpointTaskInfo
- type CheckpointTaskOpts
- type Client
- func (c *Client) Close() error
- func (c *Client) ContainerService() containers.Store
- func (c *Client) Containers(ctx context.Context, filters ...string) ([]Container, error)
- func (c *Client) ContentStore() content.Store
- func (c *Client) DiffService() diff.DiffService
- func (c *Client) EventService() eventsapi.EventsClient
- func (c *Client) GetImage(ctx context.Context, ref string) (Image, error)
- func (c *Client) HealthService() grpc_health_v1.HealthClient
- func (c *Client) ImageService() images.Store
- func (c *Client) IsServing(ctx context.Context) (bool, error)
- func (c *Client) ListImages(ctx context.Context) ([]Image, error)
- func (c *Client) LoadContainer(ctx context.Context, id string) (Container, error)
- func (c *Client) NamespaceService() namespacesapi.NamespacesClient
- func (c *Client) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error)
- func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpts) (Image, error)
- func (c *Client) Push(ctx context.Context, ref string, desc ocispec.Descriptor, opts ...RemoteOpts) error
- func (c *Client) SnapshotService(snapshotterName string) snapshot.Snapshotter
- func (c *Client) TaskService() tasks.TasksClient
- func (c *Client) Version(ctx context.Context) (Version, error)
- func (c *Client) VersionService() versionservice.VersionClient
- type ClientOpt
- type Container
- type DeleteOpts
- type FIFOSet
- type IO
- type IOAttach
- type IOCloseInfo
- type IOCloserOpts
- type IOCreation
- type Image
- type NewContainerOpts
- func WithCheckpoint(desc v1.Descriptor, rootfsID string) NewContainerOpts
- func WithContainerLabels(labels map[string]string) NewContainerOpts
- func WithExistingRootFS(id string) NewContainerOpts
- func WithImage(i Image) NewContainerOpts
- func WithNewReadonlyRootFS(id string, i Image) NewContainerOpts
- func WithNewRootFS(id string, i Image) NewContainerOpts
- func WithRuntime(name string) NewContainerOpts
- func WithSnapshotter(name string) NewContainerOpts
- func WithSpec(spec *specs.Spec) NewContainerOpts
- type NewTaskOpts
- type Process
- type RemoteContext
- type RemoteOpts
- type SpecOpts
- type Task
- type TaskInfo
- type TaskStatus
- type UpdateTaskInfo
- type UpdateTaskOpts
- type Version
Constants ¶
const DefaultAddress = "/run/containerd/containerd.sock"
DefaultAddress is the default unix socket address
const UnknownExitStatus = 255
Variables ¶
This section is empty.
Functions ¶
func GenerateSpec ¶
GenerateSpec will generate a default spec from the provided image for use as a containerd container
func NewRemoteContainerStore ¶
func NewRemoteContainerStore(client containersapi.ContainersClient) containers.Store
func WithExit ¶
func WithExit(r *CheckpointTaskInfo) error
func WithPullUnpack ¶
func WithPullUnpack(client *Client, c *RemoteContext) error
WithPullUnpack is used to unpack an image after pull. This uses the snapshotter, content store, and diff service configured for the client.
func WithRootFSDeletion ¶
WithRootFSDeletion deletes the rootfs allocated for the container
func WithSchema1Conversion ¶
func WithSchema1Conversion(client *Client, c *RemoteContext) error
WithSchema1Conversion is used to convert Docker registry schema 1 manifests to oci manifests on pull. Without this option schema 1 manifests will return a not supported error.
func WithStdinCloser ¶
func WithStdinCloser(r *IOCloseInfo)
Types ¶
type CheckpointTaskInfo ¶
type CheckpointTaskOpts ¶
type CheckpointTaskOpts func(*CheckpointTaskInfo) error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the client to interact with containerd and its various services using a uniform interface
func New ¶
New returns a new containerd client that is connected to the containerd instance provided by address
func NewWithConn ¶
func NewWithConn(conn *grpc.ClientConn, opts ...ClientOpt) (*Client, error)
NewWithConn returns a new containerd client that is connected to the containerd instance provided by the connection
func (*Client) ContainerService ¶
func (c *Client) ContainerService() containers.Store
func (*Client) Containers ¶
Containers returns all containers created in containerd
func (*Client) ContentStore ¶
func (*Client) DiffService ¶
func (c *Client) DiffService() diff.DiffService
func (*Client) EventService ¶
func (c *Client) EventService() eventsapi.EventsClient
func (*Client) HealthService ¶
func (c *Client) HealthService() grpc_health_v1.HealthClient
func (*Client) ImageService ¶
func (*Client) ListImages ¶
ListImages returns all existing images
func (*Client) LoadContainer ¶
func (*Client) NamespaceService ¶
func (c *Client) NamespaceService() namespacesapi.NamespacesClient
func (*Client) NewContainer ¶
func (c *Client) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error)
NewContainer will create a new container in container with the provided id the id must be unique within the namespace
func (*Client) Push ¶
func (c *Client) Push(ctx context.Context, ref string, desc ocispec.Descriptor, opts ...RemoteOpts) error
func (*Client) SnapshotService ¶
func (c *Client) SnapshotService(snapshotterName string) snapshot.Snapshotter
func (*Client) TaskService ¶
func (c *Client) TaskService() tasks.TasksClient
func (*Client) VersionService ¶
func (c *Client) VersionService() versionservice.VersionClient
type ClientOpt ¶
type ClientOpt func(c *clientOpts) error
func WithDefaultNamespace ¶
func WithDialOpts ¶
func WithDialOpts(opts []grpc.DialOption) ClientOpt
WithDialOpts allows grpc.DialOptions to be set on the connection
type Container ¶
type Container interface { ID() string Info() containers.Container Delete(context.Context, ...DeleteOpts) error NewTask(context.Context, IOCreation, ...NewTaskOpts) (Task, error) Spec() (*specs.Spec, error) Task(context.Context, IOAttach) (Task, error) Image(context.Context) (Image, error) Labels(context.Context) (map[string]string, error) SetLabels(context.Context, map[string]string) (map[string]string, error) }
type DeleteOpts ¶
type FIFOSet ¶
type IO ¶
type IO struct { Terminal bool Stdin string Stdout string Stderr string // contains filtered or unexported fields }
func Stdio ¶
Stdio returns an IO implementation to be used for a task that outputs the container's IO as the current processes Stdio
func StdioTerminal ¶
StdioTerminal will setup the IO for the task to use a terminal
type IOCloseInfo ¶
type IOCloseInfo struct {
Stdin bool
}
type IOCloserOpts ¶
type IOCloserOpts func(*IOCloseInfo)
type IOCreation ¶
func NewIOWithTerminal ¶
type NewContainerOpts ¶
func WithCheckpoint ¶
func WithCheckpoint(desc v1.Descriptor, rootfsID string) NewContainerOpts
func WithContainerLabels ¶
func WithContainerLabels(labels map[string]string) NewContainerOpts
WithContainerLabels adds the provided labels to the container
func WithExistingRootFS ¶
func WithExistingRootFS(id string) NewContainerOpts
WithExistingRootFS uses an existing root filesystem for the container
func WithImage ¶
func WithImage(i Image) NewContainerOpts
func WithNewReadonlyRootFS ¶
func WithNewReadonlyRootFS(id string, i Image) NewContainerOpts
WithNewReadonlyRootFS allocates a new snapshot to be used by the container as the root filesystem in read-only mode
func WithNewRootFS ¶
func WithNewRootFS(id string, i Image) NewContainerOpts
WithNewRootFS allocates a new snapshot to be used by the container as the root filesystem in read-write mode
func WithRuntime ¶
func WithRuntime(name string) NewContainerOpts
WithRuntime allows a user to specify the runtime name and additional options that should be used to create tasks for the container
func WithSnapshotter ¶
func WithSnapshotter(name string) NewContainerOpts
func WithSpec ¶
func WithSpec(spec *specs.Spec) NewContainerOpts
type NewTaskOpts ¶
func WithTaskCheckpoint ¶
func WithTaskCheckpoint(desc v1.Descriptor) NewTaskOpts
type RemoteContext ¶
type RemoteContext struct { // Resolver is used to resolve names to objects, fetchers, and pushers. // If no resolver is provided, defaults to Docker registry resolver. Resolver remotes.Resolver // Unpack is done after an image is pulled to extract into a snapshotter. // If an image is not unpacked on pull, it can be unpacked any time // afterwards. Unpacking is required to run an image. Unpack bool // Snapshotter used for unpacking Snapshotter string // BaseHandlers are a set of handlers which get are called on dispatch. // These handlers always get called before any operation specific // handlers. BaseHandlers []images.Handler // ConvertSchema1 is whether to convert Docker registry schema 1 // manifests. If this option is false then any image which resolves // to schema 1 will return an error since schema 1 is not supported. ConvertSchema1 bool }
RemoteContext is used to configure object resolutions and transfers with remote content stores and image providers.
type RemoteOpts ¶
type RemoteOpts func(*Client, *RemoteContext) error
func WithImageHandler ¶
func WithImageHandler(h images.Handler) RemoteOpts
WithImageHandler adds a base handler to be called on dispatch.
func WithPullSnapshotter ¶
func WithPullSnapshotter(snapshotterName string) RemoteOpts
WithPullSnapshotter specifies snapshotter name used for unpacking
func WithResolver ¶
func WithResolver(resolver remotes.Resolver) RemoteOpts
WithResolver specifies the resolver to use.
type SpecOpts ¶
func WithHostNamespace ¶
func WithHostNamespace(ns specs.LinuxNamespaceType) SpecOpts
func WithLinuxNamespace ¶
func WithLinuxNamespace(ns specs.LinuxNamespace) SpecOpts
WithLinuxNamespace uses the passed in namespace for the spec. If a namespace of the same type already exists in the spec, the existing namespace is replaced by the one provided.
func WithProcessArgs ¶
type Task ¶
type Task interface { Pid() uint32 Delete(context.Context) (uint32, error) Kill(context.Context, syscall.Signal) error Pause(context.Context) error Resume(context.Context) error Start(context.Context) error Status(context.Context) (TaskStatus, error) Wait(context.Context) (uint32, error) Exec(context.Context, string, *specs.Process, IOCreation) (Process, error) Pids(context.Context) ([]uint32, error) CloseIO(context.Context, ...IOCloserOpts) error Resize(ctx context.Context, w, h uint32) error IO() *IO Checkpoint(context.Context, ...CheckpointTaskOpts) (v1.Descriptor, error) Update(context.Context, ...UpdateTaskOpts) error }
type TaskInfo ¶
type TaskInfo struct { Checkpoint *types.Descriptor Options interface{} }
type TaskStatus ¶
type TaskStatus string
const ( Running TaskStatus = "running" Created TaskStatus = "created" Stopped TaskStatus = "stopped" Paused TaskStatus = "paused" Pausing TaskStatus = "pausing" )
type UpdateTaskInfo ¶
type UpdateTaskInfo struct {
Resources interface{}
}
type UpdateTaskOpts ¶
type UpdateTaskOpts func(context.Context, *Client, *UpdateTaskInfo) error
func WithResources ¶
func WithResources(resources *specs.LinuxResources) UpdateTaskOpts
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
api
|
|
services/containers/v1
Package containers is a generated protocol buffer package.
|
Package containers is a generated protocol buffer package. |
services/content/v1
Package content is a generated protocol buffer package.
|
Package content is a generated protocol buffer package. |
services/diff/v1
Package diff is a generated protocol buffer package.
|
Package diff is a generated protocol buffer package. |
services/events/v1
Package events is a generated protocol buffer package.
|
Package events is a generated protocol buffer package. |
services/images/v1
Package images is a generated protocol buffer package.
|
Package images is a generated protocol buffer package. |
services/namespaces/v1
Package namespaces is a generated protocol buffer package.
|
Package namespaces is a generated protocol buffer package. |
services/snapshot/v1
Package snapshot is a generated protocol buffer package.
|
Package snapshot is a generated protocol buffer package. |
services/tasks/v1
Package tasks is a generated protocol buffer package.
|
Package tasks is a generated protocol buffer package. |
services/version/v1
Package version is a generated protocol buffer package.
|
Package version is a generated protocol buffer package. |
types
Package types is a generated protocol buffer package.
|
Package types is a generated protocol buffer package. |
types/task
Package task is a generated protocol buffer package.
|
Package task is a generated protocol buffer package. |
cmd
|
|
Package errdefs defines the common errors used throughout containerd packages.
|
Package errdefs defines the common errors used throughout containerd packages. |
Package filters defines a syntax and parser that can be used for the filtration of items across the containerd API.
|
Package filters defines a syntax and parser that can be used for the filtration of items across the containerd API. |
Package gc experiments with providing central gc tooling to ensure deterministic resource removal within containerd.
|
Package gc experiments with providing central gc tooling to ensure deterministic resource removal within containerd. |
Package identifiers provides common validation for identifiers and keys across containerd.
|
Package identifiers provides common validation for identifiers and keys across containerd. |
runcopts
Package runcopts is a generated protocol buffer package.
|
Package runcopts is a generated protocol buffer package. |
shim/v1
Package shim is a generated protocol buffer package.
|
Package shim is a generated protocol buffer package. |
metrics
|
|
Package namespaces provides tools for working with namespaces across containerd.
|
Package namespaces provides tools for working with namespaces across containerd. |
Package oci provides basic operations for manipulating OCI images.
|
Package oci provides basic operations for manipulating OCI images. |
Package progress assists in displaying human readable progress information.
|
Package progress assists in displaying human readable progress information. |
services
|
|
storage
Package storage provides a metadata storage implementation for snapshot drivers.
|
Package storage provides a metadata storage implementation for snapshot drivers. |
storage/proto
Package proto is a generated protocol buffer package.
|
Package proto is a generated protocol buffer package. |
Package sys provides access to the Get Child and Set Child prctl flags.
|
Package sys provides access to the Get Child and Set Child prctl flags. |