containerd: github.com/containerd/containerd Index | Files | Directories

package containerd

import "github.com/containerd/containerd"

Index

Package Files

client.go client_opts.go container.go container_checkpoint_opts.go container_opts.go container_opts_unix.go container_restore_opts.go containerstore.go diff.go events.go export.go grpc.go image.go image_store.go import.go install.go install_opts.go lease.go namespaces.go process.go services.go signal_map_linux.go signals.go snapshotter_default_linux.go task.go task_opts.go task_opts_unix.go

Constants

const (
    // DefaultSnapshotter will set the default snapshotter for the platform.
    // This will be based on the client compilation target, so take that into
    // account when choosing this value.
    DefaultSnapshotter = "overlayfs"
)
const StopSignalLabel = "io.containerd.image.config.stop-signal"

StopSignalLabel is a well-known containerd label for storing the stop signal specified in the OCI image config

const UnknownExitStatus = 255

UnknownExitStatus is returned when containerd is unable to determine the exit status of a process. This can happen if the process never starts or if an error was encountered when obtaining the exit status, it is set to 255.

Variables

var (
    // ErrCheckpointRWUnsupported is returned if the container runtime does not support checkpoint
    ErrCheckpointRWUnsupported = errors.New("rw checkpoint is only supported on v2 runtimes")
    // ErrMediaTypeNotFound returns an error when a media type in the manifest is unknown
    ErrMediaTypeNotFound = errors.New("media type not found")
)
var (
    // ErrImageNameNotFoundInIndex is returned when the image name is not found in the index
    ErrImageNameNotFoundInIndex = errors.New("image name not found in index")
    // ErrRuntimeNameNotFoundInIndex is returned when the runtime is not found in the index
    ErrRuntimeNameNotFoundInIndex = errors.New("runtime not found in index")
    // ErrSnapshotterNameNotFoundInIndex is returned when the snapshotter is not found in the index
    ErrSnapshotterNameNotFoundInIndex = errors.New("snapshotter not found in index")
)

func GetIndexByMediaType Uses

func GetIndexByMediaType(index *imagespec.Index, mt string) (*imagespec.Descriptor, error)

GetIndexByMediaType returns the index in a manifest for the specified media type

func GetOCIStopSignal Uses

func GetOCIStopSignal(ctx context.Context, image Image, defaultSignal string) (string, error)

GetOCIStopSignal retrieves the stop signal specified in the OCI image config

func GetStopSignal Uses

func GetStopSignal(ctx context.Context, container Container, defaultSignal syscall.Signal) (syscall.Signal, error)

GetStopSignal retrieves the container stop signal, specified by the well-known containerd label (StopSignalLabel)

func NewImageStoreFromClient Uses

func NewImageStoreFromClient(client imagesapi.ImagesClient) images.Store

NewImageStoreFromClient returns a new image store client

func NewNamespaceStoreFromClient Uses

func NewNamespaceStoreFromClient(client api.NamespacesClient) namespaces.Store

NewNamespaceStoreFromClient returns a new namespace store

func NewRemoteContainerStore Uses

func NewRemoteContainerStore(client containersapi.ContainersClient) containers.Store

NewRemoteContainerStore returns the container Store connected with the provided client

func ParseSignal Uses

func ParseSignal(rawSignal string) (syscall.Signal, error)

ParseSignal parses a given string into a syscall.Signal it checks that the signal exists in the platform-appropriate signalMap

func WithCheckpointImage Uses

func WithCheckpointImage(ctx context.Context, client *Client, c *containers.Container, index *imagespec.Index, copts *options.CheckpointOptions) error

WithCheckpointImage includes the container image in the checkpoint

func WithCheckpointRW Uses

func WithCheckpointRW(ctx context.Context, client *Client, c *containers.Container, index *imagespec.Index, copts *options.CheckpointOptions) error

WithCheckpointRW includes the rw in the checkpoint

func WithCheckpointRuntime Uses

func WithCheckpointRuntime(ctx context.Context, client *Client, c *containers.Container, index *imagespec.Index, copts *options.CheckpointOptions) error

WithCheckpointRuntime includes the container runtime info

func WithCheckpointTask Uses

func WithCheckpointTask(ctx context.Context, client *Client, c *containers.Container, index *imagespec.Index, copts *options.CheckpointOptions) error

WithCheckpointTask includes the running task

func WithCheckpointTaskExit Uses

func WithCheckpointTaskExit(ctx context.Context, client *Client, c *containers.Container, index *imagespec.Index, copts *options.CheckpointOptions) error

WithCheckpointTaskExit causes the task to exit after checkpoint

func WithInstallLibs Uses

func WithInstallLibs(c *InstallConfig)

WithInstallLibs installs libs from the image

func WithInstallReplace Uses

func WithInstallReplace(c *InstallConfig)

WithInstallReplace will replace existing files

func WithKillAll Uses

func WithKillAll(ctx context.Context, i *KillInfo) error

WithKillAll kills all processes for a task

func WithNoNewKeyring Uses

func WithNoNewKeyring(ctx context.Context, c *Client, ti *TaskInfo) error

WithNoNewKeyring causes tasks not to be created with a new keyring for secret storage. There is an upper limit on the number of keyrings in a linux system

func WithNoPivotRoot Uses

func WithNoPivotRoot(_ context.Context, _ *Client, info *TaskInfo) error

WithNoPivotRoot instructs the runtime not to you pivot_root

func WithProcessKill Uses

func WithProcessKill(ctx context.Context, p Process) error

WithProcessKill will forcefully kill and delete a process

func WithPullUnpack Uses

func WithPullUnpack(_ *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 WithSchema1Conversion Uses

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 WithSnapshotCleanup Uses

func WithSnapshotCleanup(ctx context.Context, client *Client, c containers.Container) error

WithSnapshotCleanup deletes the rootfs snapshot allocated for the container

func WithStdinCloser Uses

func WithStdinCloser(r *IOCloseInfo)

WithStdinCloser closes the stdin of a process

type CheckpointOpts Uses

type CheckpointOpts func(context.Context, *Client, *containers.Container, *imagespec.Index, *options.CheckpointOptions) error

CheckpointOpts are options to manage the checkpoint operation

type CheckpointTaskInfo Uses

type CheckpointTaskInfo struct {
    Name string
    // ParentCheckpoint is the digest of a parent checkpoint
    ParentCheckpoint digest.Digest
    // Options hold runtime specific settings for checkpointing a task
    Options interface{}
}

CheckpointTaskInfo allows specific checkpoint information to be set for the task

type CheckpointTaskOpts Uses

type CheckpointTaskOpts func(*CheckpointTaskInfo) error

CheckpointTaskOpts allows the caller to set checkpoint options

func WithCheckpointName Uses

func WithCheckpointName(name string) CheckpointTaskOpts

WithCheckpointName sets the image name for the checkpoint

type Client Uses

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 Uses

func New(address string, opts ...ClientOpt) (*Client, error)

New returns a new containerd client that is connected to the containerd instance provided by address

func NewWithConn Uses

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) Close Uses

func (c *Client) Close() error

Close closes the clients connection to containerd

func (*Client) ContainerService Uses

func (c *Client) ContainerService() containers.Store

ContainerService returns the underlying container Store

func (*Client) Containers Uses

func (c *Client) Containers(ctx context.Context, filters ...string) ([]Container, error)

Containers returns all containers created in containerd

func (*Client) ContentStore Uses

func (c *Client) ContentStore() content.Store

ContentStore returns the underlying content Store

func (*Client) DiffService Uses

func (c *Client) DiffService() DiffService

DiffService returns the underlying Differ

func (*Client) EventService Uses

func (c *Client) EventService() EventService

EventService returns the underlying event service

func (*Client) Export Uses

func (c *Client) Export(ctx context.Context, exporter images.Exporter, desc ocispec.Descriptor, opts ...ExportOpt) (io.ReadCloser, error)

Export exports an image to a Tar stream. OCI format is used by default. It is up to caller to put "org.opencontainers.image.ref.name" annotation to desc. TODO(AkihiroSuda): support exporting multiple descriptors at once to a single archive stream.

func (*Client) Fetch Uses

func (c *Client) Fetch(ctx context.Context, ref string, opts ...RemoteOpt) (images.Image, error)

Fetch downloads the provided content into containerd's content store and returns a non-platform specific image reference

func (*Client) GetImage Uses

func (c *Client) GetImage(ctx context.Context, ref string) (Image, error)

GetImage returns an existing image

func (*Client) HealthService Uses

func (c *Client) HealthService() grpc_health_v1.HealthClient

HealthService returns the underlying GRPC HealthClient

func (*Client) ImageService Uses

func (c *Client) ImageService() images.Store

ImageService returns the underlying image Store

func (*Client) Import Uses

func (c *Client) Import(ctx context.Context, reader io.Reader, opts ...ImportOpt) ([]images.Image, error)

Import imports an image from a Tar stream using reader. Caller needs to specify importer. Future version may use oci.v1 as the default. Note that unreferrenced blobs may be imported to the content store as well.

func (*Client) Install Uses

func (c *Client) Install(ctx context.Context, image Image, opts ...InstallOpts) error

Install a binary image into the opt service

func (*Client) IntrospectionService Uses

func (c *Client) IntrospectionService() introspectionapi.IntrospectionClient

IntrospectionService returns the underlying Introspection Client

func (*Client) IsServing Uses

func (c *Client) IsServing(ctx context.Context) (bool, error)

IsServing returns true if the client can successfully connect to the containerd daemon and the healthcheck service returns the SERVING response. This call will block if a transient error is encountered during connection. A timeout can be set in the context to ensure it returns early.

func (*Client) LeasesService Uses

func (c *Client) LeasesService() leases.Manager

LeasesService returns the underlying Leases Client

func (*Client) ListImages Uses

func (c *Client) ListImages(ctx context.Context, filters ...string) ([]Image, error)

ListImages returns all existing images

func (*Client) LoadContainer Uses

func (c *Client) LoadContainer(ctx context.Context, id string) (Container, error)

LoadContainer loads an existing container from metadata

func (*Client) NamespaceService Uses

func (c *Client) NamespaceService() namespaces.Store

NamespaceService returns the underlying Namespaces Store

func (*Client) NewContainer Uses

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) Pull Uses

func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpt) (Image, error)

Pull downloads the provided content into containerd's content store and returns a platform specific image object

func (*Client) Push Uses

func (c *Client) Push(ctx context.Context, ref string, desc ocispec.Descriptor, opts ...RemoteOpt) error

Push uploads the provided content to a remote resource

func (*Client) Reconnect Uses

func (c *Client) Reconnect() error

Reconnect re-establishes the GRPC connection to the containerd daemon

func (*Client) Restore Uses

func (c *Client) Restore(ctx context.Context, id string, checkpoint Image, opts ...RestoreOpts) (Container, error)

Restore restores a container from a checkpoint

func (*Client) SnapshotService Uses

func (c *Client) SnapshotService(snapshotterName string) snapshots.Snapshotter

SnapshotService returns the underlying snapshotter for the provided snapshotter name

func (*Client) Subscribe Uses

func (c *Client) Subscribe(ctx context.Context, filters ...string) (ch <-chan *events.Envelope, errs <-chan error)

Subscribe to events that match one or more of the provided filters.

Callers should listen on both the envelope and errs channels. If the errs channel returns nil or an error, the subscriber should terminate.

The subscriber can stop receiving events by canceling the provided context. The errs channel will be closed and return a nil error.

func (*Client) TaskService Uses

func (c *Client) TaskService() tasks.TasksClient

TaskService returns the underlying TasksClient

func (*Client) Version Uses

func (c *Client) Version(ctx context.Context) (Version, error)

Version returns the version of containerd that the client is connected to

func (*Client) VersionService Uses

func (c *Client) VersionService() versionservice.VersionClient

VersionService returns the underlying VersionClient

func (*Client) WithLease Uses

func (c *Client) WithLease(ctx context.Context) (context.Context, func(context.Context) error, error)

WithLease attaches a lease on the context

type ClientOpt Uses

type ClientOpt func(c *clientOpts) error

ClientOpt allows callers to set options on the containerd client

func WithDefaultNamespace Uses

func WithDefaultNamespace(ns string) ClientOpt

WithDefaultNamespace sets the default namespace on the client

Any operation that does not have a namespace set on the context will be provided the default namespace

func WithDefaultRuntime Uses

func WithDefaultRuntime(rt string) ClientOpt

WithDefaultRuntime sets the default runtime on the client

func WithDialOpts Uses

func WithDialOpts(opts []grpc.DialOption) ClientOpt

WithDialOpts allows grpc.DialOptions to be set on the connection

func WithServices Uses

func WithServices(opts ...ServicesOpt) ClientOpt

WithServices sets services used by the client.

func WithTimeout Uses

func WithTimeout(d time.Duration) ClientOpt

WithTimeout sets the connection timeout for the client

type Container Uses

type Container interface {
    // ID identifies the container
    ID() string
    // Info returns the underlying container record type
    Info(context.Context) (containers.Container, error)
    // Delete removes the container
    Delete(context.Context, ...DeleteOpts) error
    // NewTask creates a new task based on the container metadata
    NewTask(context.Context, cio.Creator, ...NewTaskOpts) (Task, error)
    // Spec returns the OCI runtime specification
    Spec(context.Context) (*oci.Spec, error)
    // Task returns the current task for the container
    //
    // If cio.Attach options are passed the client will reattach to the IO for the running
    // task. If no task exists for the container a NotFound error is returned
    //
    // Clients must make sure that only one reader is attached to the task and consuming
    // the output from the task's fifos
    Task(context.Context, cio.Attach) (Task, error)
    // Image returns the image that the container is based on
    Image(context.Context) (Image, error)
    // Labels returns the labels set on the container
    Labels(context.Context) (map[string]string, error)
    // SetLabels sets the provided labels for the container and returns the final label set
    SetLabels(context.Context, map[string]string) (map[string]string, error)
    // Extensions returns the extensions set on the container
    Extensions(context.Context) (map[string]prototypes.Any, error)
    // Update a container
    Update(context.Context, ...UpdateContainerOpts) error
    // Checkpoint creates a checkpoint image of the current container
    Checkpoint(context.Context, string, ...CheckpointOpts) (Image, error)
}

Container is a metadata object for container resources and task creation

type DeleteOpts Uses

type DeleteOpts func(ctx context.Context, client *Client, c containers.Container) error

DeleteOpts allows the caller to set options for the deletion of a container

type DiffService Uses

type DiffService interface {
    diff.Comparer
    diff.Applier
}

DiffService handles the computation and application of diffs

func NewDiffServiceFromClient Uses

func NewDiffServiceFromClient(client diffapi.DiffClient) DiffService

NewDiffServiceFromClient returns a new diff service which communicates over a GRPC connection.

type EventService Uses

type EventService interface {
    events.Publisher
    events.Forwarder
    events.Subscriber
}

EventService handles the publish, forward and subscribe of events.

func NewEventServiceFromClient Uses

func NewEventServiceFromClient(client eventsapi.EventsClient) EventService

NewEventServiceFromClient returns a new event service which communicates over a GRPC connection.

type ExitStatus Uses

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

ExitStatus encapsulates a process' exit status. It is used by `Wait()` to return either a process exit code or an error

func (ExitStatus) Error Uses

func (s ExitStatus) Error() error

Error returns the error, if any, that occurred while waiting for the process.

func (ExitStatus) ExitCode Uses

func (s ExitStatus) ExitCode() uint32

ExitCode returns the exit code of the process. This is only valid is Error() returns nil

func (ExitStatus) ExitTime Uses

func (s ExitStatus) ExitTime() time.Time

ExitTime returns the exit time of the process This is only valid is Error() returns nil

func (ExitStatus) Result Uses

func (s ExitStatus) Result() (uint32, time.Time, error)

Result returns the exit code and time of the exit status. An error may be returned here to which indicates there was an error

at some point while waiting for the exit status. It does not signify
an error with the process itself.

If an error is returned, the process may still be running.

type ExportOpt Uses

type ExportOpt func(c *exportOpts) error

ExportOpt allows the caller to specify export-specific options

type IOCloseInfo Uses

type IOCloseInfo struct {
    Stdin bool
}

IOCloseInfo allows specific io pipes to be closed on a process

type IOCloserOpts Uses

type IOCloserOpts func(*IOCloseInfo)

IOCloserOpts allows the caller to set specific pipes as closed on a process

type Image Uses

type Image interface {
    // Name of the image
    Name() string
    // Target descriptor for the image content
    Target() ocispec.Descriptor
    // Labels of the image
    Labels() map[string]string
    // Unpack unpacks the image's content into a snapshot
    Unpack(context.Context, string) error
    // RootFS returns the unpacked diffids that make up images rootfs.
    RootFS(ctx context.Context) ([]digest.Digest, error)
    // Size returns the total size of the image's packed resources.
    Size(ctx context.Context) (int64, error)
    // Config descriptor for the image.
    Config(ctx context.Context) (ocispec.Descriptor, error)
    // IsUnpacked returns whether or not an image is unpacked.
    IsUnpacked(context.Context, string) (bool, error)
    // ContentStore provides a content store which contains image blob data
    ContentStore() content.Store
}

Image describes an image used by containers

func NewImage Uses

func NewImage(client *Client, i images.Image) Image

NewImage returns a client image object from the metadata image

func NewImageWithPlatform Uses

func NewImageWithPlatform(client *Client, i images.Image, platform platforms.MatchComparer) Image

NewImageWithPlatform returns a client image object from the metadata image

type ImportOpt Uses

type ImportOpt func(*importOpts) error

ImportOpt allows the caller to specify import specific options

func WithDigestRef Uses

func WithDigestRef(f func(digest.Digest) string) ImportOpt

WithDigestRef is used to create digest images for each manifest in the index.

func WithImageRefTranslator Uses

func WithImageRefTranslator(f func(string) string) ImportOpt

WithImageRefTranslator is used to translate the index reference to an image reference for the image store.

func WithIndexName Uses

func WithIndexName(name string) ImportOpt

WithIndexName creates a tag pointing to the imported index

type InstallConfig Uses

type InstallConfig struct {
    // Libs installs libs from the image
    Libs bool
    // Replace will overwrite existing binaries or libs in the opt directory
    Replace bool
    // Path to install libs and binaries to
    Path string
}

InstallConfig sets the binary install configuration

type InstallOpts Uses

type InstallOpts func(*InstallConfig)

InstallOpts configures binary installs

func WithInstallPath Uses

func WithInstallPath(path string) InstallOpts

WithInstallPath sets the optional install path

type KillInfo Uses

type KillInfo struct {
    // All kills all processes inside the task
    // only valid on tasks, ignored on processes
    All bool
    // ExecID is the ID of a process to kill
    ExecID string
}

KillInfo contains information on how to process a Kill action

type KillOpts Uses

type KillOpts func(context.Context, *KillInfo) error

KillOpts allows options to be set for the killing of a process

func WithKillExecID Uses

func WithKillExecID(execID string) KillOpts

WithKillExecID specifies the process ID

type NewContainerOpts Uses

type NewContainerOpts func(ctx context.Context, client *Client, c *containers.Container) error

NewContainerOpts allows the caller to set additional options when creating a container

func WithContainerExtension Uses

func WithContainerExtension(name string, extension interface{}) NewContainerOpts

WithContainerExtension appends extension data to the container object. Use this to decorate the container object with additional data for the client integration.

Make sure to register the type of `extension` in the typeurl package via `typeurl.Register` or container creation may fail.

func WithContainerLabels Uses

func WithContainerLabels(labels map[string]string) NewContainerOpts

WithContainerLabels adds the provided labels to the container

func WithImage Uses

func WithImage(i Image) NewContainerOpts

WithImage sets the provided image as the base for the container

func WithImageStopSignal Uses

func WithImageStopSignal(image Image, defaultSignal string) NewContainerOpts

WithImageStopSignal sets a well-known containerd label (StopSignalLabel) on the container for storing the stop signal specified in the OCI image config

func WithNewSnapshot Uses

func WithNewSnapshot(id string, i Image) NewContainerOpts

WithNewSnapshot allocates a new snapshot to be used by the container as the root filesystem in read-write mode

func WithNewSnapshotView Uses

func WithNewSnapshotView(id string, i Image) NewContainerOpts

WithNewSnapshotView allocates a new snapshot to be used by the container as the root filesystem in read-only mode

func WithNewSpec Uses

func WithNewSpec(opts ...oci.SpecOpts) NewContainerOpts

WithNewSpec generates a new spec for a new container

func WithRemappedSnapshot Uses

func WithRemappedSnapshot(id string, i Image, uid, gid uint32) NewContainerOpts

WithRemappedSnapshot creates a new snapshot and remaps the uid/gid for the filesystem to be used by a container with user namespaces

func WithRemappedSnapshotView Uses

func WithRemappedSnapshotView(id string, i Image, uid, gid uint32) NewContainerOpts

WithRemappedSnapshotView is similar to WithRemappedSnapshot but rootfs is mounted as read-only.

func WithRestoreImage Uses

func WithRestoreImage(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index) NewContainerOpts

WithRestoreImage restores the image for the container

func WithRestoreRW Uses

func WithRestoreRW(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index) NewContainerOpts

WithRestoreRW restores the rw layer from the checkpoint for the container

func WithRestoreRuntime Uses

func WithRestoreRuntime(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index) NewContainerOpts

WithRestoreRuntime restores the runtime for the container

func WithRestoreSpec Uses

func WithRestoreSpec(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index) NewContainerOpts

WithRestoreSpec restores the spec from the checkpoint for the container

func WithRuntime Uses

func WithRuntime(name string, options interface{}) NewContainerOpts

WithRuntime allows a user to specify the runtime name and additional options that should be used to create tasks for the container

func WithSnapshot Uses

func WithSnapshot(id string) NewContainerOpts

WithSnapshot uses an existing root filesystem for the container

func WithSnapshotter Uses

func WithSnapshotter(name string) NewContainerOpts

WithSnapshotter sets the provided snapshotter for use by the container

This option must appear before other snapshotter options to have an effect.

func WithSpec Uses

func WithSpec(s *oci.Spec, opts ...oci.SpecOpts) NewContainerOpts

WithSpec sets the provided spec on the container

type NewTaskOpts Uses

type NewTaskOpts func(context.Context, *Client, *TaskInfo) error

NewTaskOpts allows the caller to set options on a new task

func WithRootFS Uses

func WithRootFS(mounts []mount.Mount) NewTaskOpts

WithRootFS allows a task to be created without a snapshot being allocated to its container

func WithTaskCheckpoint Uses

func WithTaskCheckpoint(im Image) NewTaskOpts

WithTaskCheckpoint allows a task to be created with live runtime and memory data from a previous checkpoint. Additional software such as CRIU may be required to restore a task from a checkpoint

type Process Uses

type Process interface {
    // ID of the process
    ID() string
    // Pid is the system specific process id
    Pid() uint32
    // Start starts the process executing the user's defined binary
    Start(context.Context) error
    // Delete removes the process and any resources allocated returning the exit status
    Delete(context.Context, ...ProcessDeleteOpts) (*ExitStatus, error)
    // Kill sends the provided signal to the process
    Kill(context.Context, syscall.Signal, ...KillOpts) error
    // Wait asynchronously waits for the process to exit, and sends the exit code to the returned channel
    Wait(context.Context) (<-chan ExitStatus, error)
    // CloseIO allows various pipes to be closed on the process
    CloseIO(context.Context, ...IOCloserOpts) error
    // Resize changes the width and heigh of the process's terminal
    Resize(ctx context.Context, w, h uint32) error
    // IO returns the io set for the process
    IO() cio.IO
    // Status returns the executing status of the process
    Status(context.Context) (Status, error)
}

Process represents a system process

type ProcessDeleteOpts Uses

type ProcessDeleteOpts func(context.Context, Process) error

ProcessDeleteOpts allows the caller to set options for the deletion of a task

type ProcessInfo Uses

type ProcessInfo struct {
    // Pid is the process ID
    Pid uint32
    // Info includes additional process information
    // Info varies by platform
    Info *google_protobuf.Any
}

ProcessInfo provides platform specific process information

type ProcessStatus Uses

type ProcessStatus string

ProcessStatus returns a human readable status for the Process representing its current status

const (
    // Running indicates the process is currently executing
    Running ProcessStatus = "running"
    // Created indicates the process has been created within containerd but the
    // user's defined process has not started
    Created ProcessStatus = "created"
    // Stopped indicates that the process has ran and exited
    Stopped ProcessStatus = "stopped"
    // Paused indicates that the process is currently paused
    Paused ProcessStatus = "paused"
    // Pausing indicates that the process is currently switching from a
    // running state into a paused state
    Pausing ProcessStatus = "pausing"
    // Unknown indicates that we could not determine the status from the runtime
    Unknown ProcessStatus = "unknown"
)

type RemoteContext Uses

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

    // PlatformMatcher is used to match the platforms for an image
    // operation and define the preference when a single match is required
    // from multiple platforms.
    PlatformMatcher platforms.MatchComparer

    // 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

    // Labels to be applied to the created image
    Labels map[string]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

    // Platforms defines which platforms to handle when doing the image operation.
    // Platforms is ignored when a PlatformMatcher is set, otherwise the
    // platforms will be used to create a PlatformMatcher with no ordering
    // preference.
    Platforms []string
}

RemoteContext is used to configure object resolutions and transfers with remote content stores and image providers.

type RemoteOpt Uses

type RemoteOpt func(*Client, *RemoteContext) error

RemoteOpt allows the caller to set distribution options for a remote

func WithImageHandler Uses

func WithImageHandler(h images.Handler) RemoteOpt

WithImageHandler adds a base handler to be called on dispatch.

func WithPlatform Uses

func WithPlatform(platform string) RemoteOpt

WithPlatform allows the caller to specify a platform to retrieve content for

func WithPlatformMatcher Uses

func WithPlatformMatcher(m platforms.MatchComparer) RemoteOpt

WithPlatformMatcher specifies the matcher to use for determining which platforms to pull content for. This value supersedes anything set with `WithPlatform`.

func WithPullLabel Uses

func WithPullLabel(key, value string) RemoteOpt

WithPullLabel sets a label to be associated with a pulled reference

func WithPullLabels Uses

func WithPullLabels(labels map[string]string) RemoteOpt

WithPullLabels associates a set of labels to a pulled reference

func WithPullSnapshotter Uses

func WithPullSnapshotter(snapshotterName string) RemoteOpt

WithPullSnapshotter specifies snapshotter name used for unpacking

func WithResolver Uses

func WithResolver(resolver remotes.Resolver) RemoteOpt

WithResolver specifies the resolver to use.

type RestoreOpts Uses

type RestoreOpts func(context.Context, string, *Client, Image, *imagespec.Index) NewContainerOpts

RestoreOpts are options to manage the restore operation

type ServicesOpt Uses

type ServicesOpt func(c *services)

ServicesOpt allows callers to set options on the services

func WithContainerService Uses

func WithContainerService(containerService containersapi.ContainersClient) ServicesOpt

WithContainerService sets the container service.

func WithContentStore Uses

func WithContentStore(contentStore content.Store) ServicesOpt

WithContentStore sets the content store.

func WithDiffService Uses

func WithDiffService(diffService diff.DiffClient) ServicesOpt

WithDiffService sets the diff service.

func WithEventService Uses

func WithEventService(eventService EventService) ServicesOpt

WithEventService sets the event service.

func WithImageService Uses

func WithImageService(imageService imagesapi.ImagesClient) ServicesOpt

WithImageService sets the image service.

func WithLeasesService Uses

func WithLeasesService(leasesService leases.Manager) ServicesOpt

WithLeasesService sets the lease service.

func WithNamespaceService Uses

func WithNamespaceService(namespaceService namespacesapi.NamespacesClient) ServicesOpt

WithNamespaceService sets the namespace service.

func WithSnapshotters Uses

func WithSnapshotters(snapshotters map[string]snapshots.Snapshotter) ServicesOpt

WithSnapshotters sets the snapshotters.

func WithTaskService Uses

func WithTaskService(taskService tasks.TasksClient) ServicesOpt

WithTaskService sets the task service.

type Status Uses

type Status struct {
    // Status of the process
    Status ProcessStatus
    // ExitStatus returned by the process
    ExitStatus uint32
    // ExitedTime is the time at which the process died
    ExitTime time.Time
}

Status returns process status and exit information

type Task Uses

type Task interface {
    Process

    // Pause suspends the execution of the task
    Pause(context.Context) error
    // Resume the execution of the task
    Resume(context.Context) error
    // Exec creates a new process inside the task
    Exec(context.Context, string, *specs.Process, cio.Creator) (Process, error)
    // Pids returns a list of system specific process ids inside the task
    Pids(context.Context) ([]ProcessInfo, error)
    // Checkpoint serializes the runtime and memory information of a task into an
    // OCI Index that can be push and pulled from a remote resource.
    //
    // Additional software like CRIU maybe required to checkpoint and restore tasks
    Checkpoint(context.Context, ...CheckpointTaskOpts) (Image, error)
    // Update modifies executing tasks with updated settings
    Update(context.Context, ...UpdateTaskOpts) error
    // LoadProcess loads a previously created exec'd process
    LoadProcess(context.Context, string, cio.Attach) (Process, error)
    // Metrics returns task metrics for runtime specific metrics
    //
    // The metric types are generic to containerd and change depending on the runtime
    // For the built in Linux runtime, github.com/containerd/cgroups.Metrics
    // are returned in protobuf format
    Metrics(context.Context) (*types.Metric, error)
}

Task is the executable object within containerd

type TaskInfo Uses

type TaskInfo struct {
    // Checkpoint is the Descriptor for an existing checkpoint that can be used
    // to restore a task's runtime and memory state
    Checkpoint *types.Descriptor
    // RootFS is a list of mounts to use as the task's root filesystem
    RootFS []mount.Mount
    // Options hold runtime specific settings for task creation
    Options interface{}
}

TaskInfo sets options for task creation

type UpdateContainerOpts Uses

type UpdateContainerOpts func(ctx context.Context, client *Client, c *containers.Container) error

UpdateContainerOpts allows the caller to set additional options when updating a container

type UpdateTaskInfo Uses

type UpdateTaskInfo struct {
    // Resources updates a tasks resource constraints
    Resources interface{}
}

UpdateTaskInfo allows updated specific settings to be changed on a task

type UpdateTaskOpts Uses

type UpdateTaskOpts func(context.Context, *Client, *UpdateTaskInfo) error

UpdateTaskOpts allows a caller to update task settings

func WithResources Uses

func WithResources(resources interface{}) UpdateTaskOpts

WithResources sets the provided resources for task updates. Resources must be either a *specs.LinuxResources or a *specs.WindowsResources

type Version Uses

type Version struct {
    // Version number
    Version string
    // Revision from git that was built
    Revision string
}

Version of containerd

Directories

PathSynopsis
api/eventsPackage events is a generated protocol buffer package.
api/services/containers/v1Package containers is a generated protocol buffer package.
api/services/content/v1Package content is a generated protocol buffer package.
api/services/diff/v1Package diff is a generated protocol buffer package.
api/services/events/v1Package events defines the event pushing and subscription service.
api/services/images/v1Package images is a generated protocol buffer package.
api/services/introspection/v1Package introspection is a generated protocol buffer package.
api/services/leases/v1Package leases is a generated protocol buffer package.
api/services/namespaces/v1Package namespaces is a generated protocol buffer package.
api/services/snapshots/v1Package snapshots is a generated protocol buffer package.
api/services/tasks/v1Package tasks is a generated protocol buffer package.
api/services/version/v1Package version is a generated protocol buffer package.
api/typesPackage types is a generated protocol buffer package.
api/types/taskPackage task is a generated protocol buffer package.
archive
archive/compression
archive/tartest
cio
cmd/containerd
cmd/containerd/command
cmd/containerd-shim
cmd/containerd-shim-runc-v1
cmd/containerd-shim-runhcs-v1
cmd/containerd-stress
cmd/ctr
cmd/ctr/app
cmd/ctr/commands
cmd/ctr/commands/containers
cmd/ctr/commands/content
cmd/ctr/commands/events
cmd/ctr/commands/images
cmd/ctr/commands/install
cmd/ctr/commands/leases
cmd/ctr/commands/namespaces
cmd/ctr/commands/plugins
cmd/ctr/commands/pprof
cmd/ctr/commands/run
cmd/ctr/commands/shim
cmd/ctr/commands/snapshots
cmd/ctr/commands/tasks
cmd/ctr/commands/version
cmd/protoc-gen-gogoctrd
containers
content
content/local
content/proxy
content/testsuite
contrib/apparmor
contrib/nvidia
contrib/seccomp
contrib/snapshotservice
defaultsPackage defaults provides several common defaults for interacting with containerd.
diff
diff/apply
diff/lcow
diff/walking
diff/walking/plugin
diff/windows
errdefsPackage errdefs defines the common errors used throughout containerd packages.
events
events/exchange
filtersPackage filters defines a syntax and parser that can be used for the filtration of items across the containerd API.
gcPackage gc experiments with providing central gc tooling to ensure deterministic resource removal within containerd.
gc/scheduler
identifiersPackage identifiers provides common validation for identifiers and keys across containerd.
images
images/archivePackage archive provides a Docker and OCI compatible importer
images/oci
labels
leases
leases/proxy
log
metadata
metadata/boltutil
metrics/cgroups
mount
namespacesPackage namespaces provides tools for working with namespaces across containerd.
oci
pkg/dialer
pkg/progressPackage progress assists in displaying human readable progress information.
pkg/seed
pkg/testutil
platformsPackage platforms provides a toolkit for normalizing, matching and specifying container platforms.
plugin
protobuf/pluginPackage plugin is a generated protocol buffer package.
protobuf/plugin/fieldpath
reference
remotes
remotes/docker
remotes/docker/schema1
rootfs
runtime
runtime/linux/runctypesPackage runctypes is a generated protocol buffer package.
runtime/proc
runtime/restartPackage restart enables containers to have labels added and monitored to keep the container's task running if it is killed.
runtime/restart/monitor
runtime/v1/linux
runtime/v1/linux/proc
runtime/v1/shim
runtime/v1/shim/client
runtime/v1/shim/v1Package shim is a generated protocol buffer package.
runtime/v2
runtime/v2/runc
runtime/v2/runc/optionsPackage options is a generated protocol buffer package.
runtime/v2/runhcs
runtime/v2/runhcs/optionsPackage options is a generated protocol buffer package.
runtime/v2/shim
runtime/v2/taskPackage task is a generated protocol buffer package.
services
services/containers
services/content
services/diff
services/events
services/healthcheck
services/images
services/introspection
services/leases
services/namespaces
services/opt
services/server
services/server/config
services/snapshots
services/tasks
services/version
snapshots
snapshots/btrfs
snapshots/lcow
snapshots/native
snapshots/overlay
snapshots/proxy
snapshots/storagePackage storage provides a metadata storage implementation for snapshot drivers.
snapshots/testsuite
snapshots/windows
sys
version
windows
windows/hcsshimtypesPackage hcsshimtypes holds the windows runtime specific types

Package containerd imports 70 packages (graph) and is imported by 83 packages. Updated 2018-12-15. Refresh now. Tools for package owners.