Documentation ¶
Index ¶
- Constants
- Variables
- func CheckRuntime(current, expected string) bool
- func GetIndexByMediaType(index *imagespec.Index, mt string) (*imagespec.Descriptor, error)
- func GetOCIStopSignal(ctx context.Context, image Image, defaultSignal string) (string, error)
- func GetStopSignal(ctx context.Context, container Container, defaultSignal syscall.Signal) (syscall.Signal, error)
- func NewImageStoreFromClient(client imagesapi.ImagesClient) images.Store
- func NewNamespaceStoreFromClient(client api.NamespacesClient) namespaces.Store
- func NewRemoteContainerStore(client containersapi.ContainersClient) containers.Store
- func ParseSignal(rawSignal string) (syscall.Signal, error)deprecated
- func WithCheckpointImage(ctx context.Context, client *Client, c *containers.Container, ...) error
- func WithCheckpointRW(ctx context.Context, client *Client, c *containers.Container, ...) error
- func WithCheckpointRuntime(ctx context.Context, client *Client, c *containers.Container, ...) error
- func WithCheckpointTask(ctx context.Context, client *Client, c *containers.Container, ...) error
- func WithCheckpointTaskExit(ctx context.Context, client *Client, c *containers.Container, ...) error
- func WithInstallLibs(c *InstallConfig)
- func WithInstallReplace(c *InstallConfig)
- func WithKillAll(ctx context.Context, i *KillInfo) error
- func WithNoNewKeyring(ctx context.Context, c *Client, ti *TaskInfo) error
- func WithNoPivotRoot(_ context.Context, _ *Client, ti *TaskInfo) error
- func WithProcessKill(ctx context.Context, p Process) error
- func WithPullUnpack(_ *Client, c *RemoteContext) error
- func WithRemapperLabels(ctrUID, hostUID, ctrGID, hostGID, length uint32) snapshots.Opt
- func WithSchema1Conversion(client *Client, c *RemoteContext) errordeprecated
- func WithSnapshotCleanup(ctx context.Context, client *Client, c containers.Container) error
- func WithStdinCloser(r *IOCloseInfo)
- func WithoutRefreshedMetadata(i *InfoConfig)
- type CheckpointOpts
- type CheckpointTaskInfo
- type CheckpointTaskOpts
- type Client
- func (c *Client) Close() error
- func (c *Client) Conn() *grpc.ClientConn
- 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) DefaultNamespace() string
- func (c *Client) DiffService() DiffService
- func (c *Client) EventService() EventService
- func (c *Client) Export(ctx context.Context, w io.Writer, opts ...archive.ExportOpt) error
- func (c *Client) Fetch(ctx context.Context, ref string, opts ...RemoteOpt) (images.Image, error)
- func (c *Client) GetImage(ctx context.Context, ref string) (Image, error)
- func (c *Client) GetLabel(ctx context.Context, label string) (string, error)
- func (c *Client) GetSnapshotterCapabilities(ctx context.Context, snapshotterName string) ([]string, error)
- func (c *Client) GetSnapshotterSupportedPlatforms(ctx context.Context, snapshotterName string) (platforms.MatchComparer, error)
- func (c *Client) HealthService() grpc_health_v1.HealthClient
- func (c *Client) ImageService() images.Store
- func (c *Client) Import(ctx context.Context, reader io.Reader, opts ...ImportOpt) ([]images.Image, error)
- func (c *Client) Install(ctx context.Context, image Image, opts ...InstallOpts) error
- func (c *Client) IntrospectionService() introspection.Service
- func (c *Client) IsServing(ctx context.Context) (bool, error)
- func (c *Client) LeasesService() leases.Manager
- func (c *Client) ListImages(ctx context.Context, filters ...string) ([]Image, error)
- func (c *Client) LoadContainer(ctx context.Context, id string) (Container, error)
- func (c *Client) LoadSandbox(ctx context.Context, id string) (Sandbox, error)
- func (c *Client) NamespaceService() namespaces.Store
- func (c *Client) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error)
- func (c *Client) NewSandbox(ctx context.Context, sandboxID string, opts ...NewSandboxOpts) (Sandbox, error)
- func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpt) (_ Image, retErr error)
- func (c *Client) Push(ctx context.Context, ref string, desc ocispec.Descriptor, opts ...RemoteOpt) error
- func (c *Client) Reconnect() error
- func (c *Client) Restore(ctx context.Context, id string, checkpoint Image, opts ...RestoreOpts) (Container, error)
- func (c *Client) Runtime() string
- func (c *Client) SandboxController() sandbox.Controller
- func (c *Client) SandboxStore() sandbox.Store
- func (c *Client) Server(ctx context.Context) (ServerInfo, error)
- func (c *Client) SnapshotService(snapshotterName string) snapshots.Snapshotter
- func (c *Client) Subscribe(ctx context.Context, filters ...string) (ch <-chan *events.Envelope, errs <-chan error)
- func (c *Client) TaskService() tasks.TasksClient
- func (c *Client) Transfer(ctx context.Context, src interface{}, dest interface{}, opts ...transfer.Opt) error
- func (c *Client) Version(ctx context.Context) (Version, error)
- func (c *Client) VersionService() versionservice.VersionClient
- func (c *Client) WithLease(ctx context.Context, opts ...leases.Opt) (context.Context, func(context.Context) error, error)
- type ClientOpt
- func WithCallOpts(opts []grpc.CallOption) ClientOpt
- func WithDefaultNamespace(ns string) ClientOpt
- func WithDefaultPlatform(platform platforms.MatchComparer) ClientOpt
- func WithDefaultRuntime(rt string) ClientOpt
- func WithDialOpts(opts []grpc.DialOption) ClientOpt
- func WithInMemoryServices(ic *plugin.InitContext) ClientOpt
- func WithServices(opts ...ServicesOpt) ClientOpt
- func WithTimeout(d time.Duration) ClientOpt
- type Container
- type DeleteOpts
- type DiffService
- type EventService
- type ExitStatus
- type IOCloseInfo
- type IOCloserOpts
- type Image
- type ImportOpt
- func WithAllPlatforms(allPlatforms bool) ImportOpt
- func WithDigestRef(f func(digest.Digest) string) ImportOpt
- func WithDiscardUnpackedLayers() ImportOpt
- func WithImageRefTranslator(f func(string) string) ImportOpt
- func WithImportCompression() ImportOpt
- func WithImportPlatform(platformMacher platforms.MatchComparer) ImportOpt
- func WithIndexName(name string) ImportOpt
- func WithSkipDigestRef(f func(string) bool) ImportOpt
- func WithSkipMissing() ImportOpt
- type InfoConfig
- type InfoOpts
- type InstallConfig
- type InstallOpts
- type KillInfo
- type KillOpts
- type NewContainerOpts
- func WithAdditionalContainerLabels(labels map[string]string) NewContainerOpts
- func WithContainerExtension(name string, extension interface{}) NewContainerOpts
- func WithContainerLabels(labels map[string]string) NewContainerOpts
- func WithImage(i Image) NewContainerOpts
- func WithImageConfigLabels(image Image) NewContainerOpts
- func WithImageName(n string) NewContainerOpts
- func WithImageStopSignal(image Image, defaultSignal string) NewContainerOpts
- func WithNewSnapshot(id string, i Image, opts ...snapshots.Opt) NewContainerOpts
- func WithNewSnapshotView(id string, i Image, opts ...snapshots.Opt) NewContainerOpts
- func WithNewSpec(opts ...oci.SpecOpts) NewContainerOpts
- func WithRemappedSnapshot(id string, i Image, uid, gid uint32) NewContainerOpts
- func WithRemappedSnapshotView(id string, i Image, uid, gid uint32) NewContainerOpts
- func WithRestoreImage(ctx context.Context, id string, client *Client, checkpoint Image, ...) NewContainerOpts
- func WithRestoreRW(ctx context.Context, id string, client *Client, checkpoint Image, ...) NewContainerOpts
- func WithRestoreRuntime(ctx context.Context, id string, client *Client, checkpoint Image, ...) NewContainerOpts
- func WithRestoreSpec(ctx context.Context, id string, client *Client, checkpoint Image, ...) NewContainerOpts
- func WithRuntime(name string, options interface{}) NewContainerOpts
- func WithSandbox(sandboxID string) NewContainerOpts
- func WithSnapshot(id string) NewContainerOpts
- func WithSnapshotter(name string) NewContainerOpts
- func WithSpec(s *oci.Spec, opts ...oci.SpecOpts) NewContainerOpts
- type NewSandboxOpts
- type NewTaskOpts
- func WithGIDOwner(gid uint32) NewTaskOpts
- func WithRestoreImagePath(path string) NewTaskOpts
- func WithRootFS(mounts []mount.Mount) NewTaskOpts
- func WithRuntimePath(absRuntimePath string) NewTaskOpts
- func WithShimCgroup(path string) NewTaskOpts
- func WithTaskCheckpoint(im Image) NewTaskOpts
- func WithUIDOwner(uid uint32) NewTaskOpts
- type Process
- type ProcessDeleteOpts
- type ProcessInfo
- type ProcessStatus
- type RemoteContext
- type RemoteOpt
- func WithAllMetadata() RemoteOpt
- func WithChildLabelMap(fn func(ocispec.Descriptor) []string) RemoteOpt
- func WithImageHandler(h images.Handler) RemoteOpt
- func WithImageHandlerWrapper(w func(images.Handler) images.Handler) RemoteOpt
- func WithMaxConcurrentDownloads(max int) RemoteOpt
- func WithMaxConcurrentUploadedLayers(max int) RemoteOpt
- func WithPlatform(platform string) RemoteOpt
- func WithPlatformMatcher(m platforms.MatchComparer) RemoteOpt
- func WithPullLabel(key, value string) RemoteOpt
- func WithPullLabels(labels map[string]string) RemoteOpt
- func WithPullSnapshotter(snapshotterName string, opts ...snapshots.Opt) RemoteOpt
- func WithResolver(resolver remotes.Resolver) RemoteOpt
- func WithUnpackOpts(opts []UnpackOpt) RemoteOpt
- type RestoreOpts
- type Sandbox
- type ServerInfo
- type ServicesOpt
- func WithContainerClient(containerService containersapi.ContainersClient) ServicesOpt
- func WithContainerStore(containerStore containers.Store) ServicesOpt
- func WithContentStore(contentStore content.Store) ServicesOpt
- func WithDiffClient(diffService diff.DiffClient) ServicesOpt
- func WithDiffService(diffService DiffService) ServicesOpt
- func WithEventService(eventService EventService) ServicesOpt
- func WithImageClient(imageService imagesapi.ImagesClient) ServicesOpt
- func WithImageStore(imageStore images.Store) ServicesOpt
- func WithIntrospectionClient(in introspectionapi.IntrospectionClient) ServicesOpt
- func WithIntrospectionService(in introspection.Service) ServicesOpt
- func WithLeasesService(leasesService leases.Manager) ServicesOpt
- func WithNamespaceClient(namespaceService namespacesapi.NamespacesClient) ServicesOpt
- func WithNamespaceService(namespaceService namespaces.Store) ServicesOpt
- func WithSandboxController(client sandbox.Controller) ServicesOpt
- func WithSandboxStore(client sandbox.Store) ServicesOpt
- func WithSnapshotters(snapshotters map[string]snapshots.Snapshotter) ServicesOpt
- func WithTaskClient(taskService tasks.TasksClient) ServicesOpt
- type Status
- type Task
- type TaskInfo
- type UnpackConfig
- type UnpackOpt
- type UpdateContainerOpts
- type UpdateTaskInfo
- type UpdateTaskOpts
- type UsageOpt
- type Version
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") )
Functions ¶
func CheckRuntime ¶ added in v1.3.0
CheckRuntime returns true if the current runtime matches the expected runtime. Providing various parts of the runtime schema will match those parts of the expected runtime
func GetIndexByMediaType ¶ added in v1.3.0
GetIndexByMediaType returns the index in a manifest for the specified media type
func GetOCIStopSignal ¶ added in v1.2.0
GetOCIStopSignal retrieves the stop signal specified in the OCI image config
func GetStopSignal ¶ added in v1.2.0
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 ¶ added in v1.0.0
func NewImageStoreFromClient(client imagesapi.ImagesClient) images.Store
NewImageStoreFromClient returns a new image store client
func NewNamespaceStoreFromClient ¶ added in v1.0.0
func NewNamespaceStoreFromClient(client api.NamespacesClient) namespaces.Store
NewNamespaceStoreFromClient returns a new namespace store
func NewRemoteContainerStore ¶ added in v1.0.0
func NewRemoteContainerStore(client containersapi.ContainersClient) containers.Store
NewRemoteContainerStore returns the container Store connected with the provided client
func ParseSignal
deprecated
added in
v1.2.0
func WithCheckpointImage ¶ added in v1.3.0
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 ¶ added in v1.3.0
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 ¶ added in v1.3.0
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 ¶ added in v1.3.0
func WithCheckpointTask(ctx context.Context, client *Client, c *containers.Container, index *imagespec.Index, copts *options.CheckpointOptions) error
WithCheckpointTask includes the running task
func WithCheckpointTaskExit ¶ added in v1.3.0
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 ¶ added in v1.2.0
func WithInstallLibs(c *InstallConfig)
WithInstallLibs installs libs from the image
func WithInstallReplace ¶ added in v1.2.0
func WithInstallReplace(c *InstallConfig)
WithInstallReplace will replace existing files
func WithKillAll ¶ added in v1.0.0
WithKillAll kills all processes for a task
func WithNoNewKeyring ¶ added in v1.2.0
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 ¶ added in v1.1.0
WithNoPivotRoot instructs the runtime not to you pivot_root
func WithProcessKill ¶ added in v1.0.0
WithProcessKill will forcefully kill and delete a process
func WithPullUnpack ¶ added in v1.0.0
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 WithRemapperLabels ¶ added in v1.4.0
WithRemapperLabels creates the labels used by any supporting snapshotter to shift the filesystem ownership (user namespace mapping) automatically; currently supported by the fuse-overlayfs snapshotter
func WithSchema1Conversion
deprecated
added in
v1.0.0
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.
Deprecated: use Schema 2 or OCI images.
func WithSnapshotCleanup ¶ added in v1.0.0
WithSnapshotCleanup deletes the rootfs snapshot allocated for the container
func WithStdinCloser ¶ added in v1.0.0
func WithStdinCloser(r *IOCloseInfo)
WithStdinCloser closes the stdin of a process
func WithoutRefreshedMetadata ¶ added in v1.3.0
func WithoutRefreshedMetadata(i *InfoConfig)
WithoutRefreshedMetadata will use the current metadata attached to the container object
Types ¶
type CheckpointOpts ¶ added in v1.3.0
type CheckpointOpts func(context.Context, *Client, *containers.Container, *imagespec.Index, *options.CheckpointOptions) error
CheckpointOpts are options to manage the checkpoint operation
type CheckpointTaskInfo ¶ added in v1.0.0
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{} // contains filtered or unexported fields }
CheckpointTaskInfo allows specific checkpoint information to be set for the task
func (*CheckpointTaskInfo) Runtime ¶ added in v1.3.0
func (i *CheckpointTaskInfo) Runtime() string
Runtime name for the container
type CheckpointTaskOpts ¶ added in v1.0.0
type CheckpointTaskOpts func(*CheckpointTaskInfo) error
CheckpointTaskOpts allows the caller to set checkpoint options
func WithCheckpointImagePath ¶ added in v1.3.0
func WithCheckpointImagePath(path string) CheckpointTaskOpts
WithCheckpointImagePath sets image path for checkpoint option
func WithCheckpointName ¶ added in v1.0.0
func WithCheckpointName(name string) CheckpointTaskOpts
WithCheckpointName sets the image name for the checkpoint
type Client ¶ added in v1.0.0
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 ¶ added in v1.0.0
New returns a new containerd client that is connected to the containerd instance provided by address
func NewWithConn ¶ added in v1.0.0
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) Conn ¶ added in v1.3.0
func (c *Client) Conn() *grpc.ClientConn
Conn returns the underlying GRPC connection object
func (*Client) ContainerService ¶ added in v1.0.0
func (c *Client) ContainerService() containers.Store
ContainerService returns the underlying container Store
func (*Client) Containers ¶ added in v1.0.0
Containers returns all containers created in containerd
func (*Client) ContentStore ¶ added in v1.0.0
ContentStore returns the underlying content Store
func (*Client) DefaultNamespace ¶ added in v1.7.0
DefaultNamespace return the default namespace
func (*Client) DiffService ¶ added in v1.0.0
func (c *Client) DiffService() DiffService
DiffService returns the underlying Differ
func (*Client) EventService ¶ added in v1.0.0
func (c *Client) EventService() EventService
EventService returns the underlying event service
func (*Client) Export ¶ added in v1.0.0
Export exports images to a Tar stream. The tar archive is in OCI format with a Docker compatible manifest when a single target platform is given.
func (*Client) Fetch ¶ added in v1.2.0
Fetch downloads the provided content into containerd's content store and returns a non-platform specific image reference
func (*Client) GetLabel ¶ added in v1.3.0
GetLabel gets a label value from namespace store If there is no default label, an empty string returned with nil error
func (*Client) GetSnapshotterCapabilities ¶ added in v1.7.0
func (c *Client) GetSnapshotterCapabilities(ctx context.Context, snapshotterName string) ([]string, error)
GetSnapshotterCapabilities returns the capabilities of a snapshotter.
func (*Client) GetSnapshotterSupportedPlatforms ¶ added in v1.5.0
func (c *Client) GetSnapshotterSupportedPlatforms(ctx context.Context, snapshotterName string) (platforms.MatchComparer, error)
GetSnapshotterSupportedPlatforms returns a platform matchers which represents the supported platforms for the given snapshotters
func (*Client) HealthService ¶ added in v1.0.0
func (c *Client) HealthService() grpc_health_v1.HealthClient
HealthService returns the underlying GRPC HealthClient
func (*Client) ImageService ¶ added in v1.0.0
ImageService returns the underlying image Store
func (*Client) Import ¶ added in v1.0.0
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 unreferenced blobs may be imported to the content store as well.
func (*Client) Install ¶ added in v1.2.0
Install a binary image into the opt service. More info: https://github.com/containerd/containerd/blob/main/docs/managed-opt.md.
func (*Client) IntrospectionService ¶ added in v1.0.0
func (c *Client) IntrospectionService() introspection.Service
IntrospectionService returns the underlying Introspection Client
func (*Client) IsServing ¶ added in v1.0.0
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 ¶ added in v1.1.0
LeasesService returns the underlying Leases Client
func (*Client) ListImages ¶ added in v1.0.0
ListImages returns all existing images
func (*Client) LoadContainer ¶ added in v1.0.0
LoadContainer loads an existing container from metadata
func (*Client) LoadSandbox ¶ added in v1.7.0
LoadSandbox laods existing sandbox metadata object using the id
func (*Client) NamespaceService ¶ added in v1.0.0
func (c *Client) NamespaceService() namespaces.Store
NamespaceService returns the underlying Namespaces Store
func (*Client) NewContainer ¶ added in v1.0.0
func (c *Client) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error)
NewContainer will create a new container with the provided id. The id must be unique within the namespace.
func (*Client) NewSandbox ¶ added in v1.7.0
func (c *Client) NewSandbox(ctx context.Context, sandboxID string, opts ...NewSandboxOpts) (Sandbox, error)
NewSandbox creates new sandbox client
func (*Client) Pull ¶ added in v1.0.0
Pull downloads the provided content into containerd's content store and returns a platform specific image object
func (*Client) Push ¶ added in v1.0.0
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 ¶ added in v1.1.0
Reconnect re-establishes the GRPC connection to the containerd daemon
func (*Client) Restore ¶ added in v1.3.0
func (c *Client) Restore(ctx context.Context, id string, checkpoint Image, opts ...RestoreOpts) (Container, error)
Restore restores a container from a checkpoint
func (*Client) SandboxController ¶ added in v1.7.0
func (c *Client) SandboxController() sandbox.Controller
SandboxController returns the underlying sandbox controller client
func (*Client) SandboxStore ¶ added in v1.7.0
SandboxStore returns the underlying sandbox store client
func (*Client) Server ¶ added in v1.3.0
func (c *Client) Server(ctx context.Context) (ServerInfo, error)
Server returns server information from the introspection service
func (*Client) SnapshotService ¶ added in v1.0.0
func (c *Client) SnapshotService(snapshotterName string) snapshots.Snapshotter
SnapshotService returns the underlying snapshotter for the provided snapshotter name
func (*Client) Subscribe ¶ added in v1.0.0
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 ¶ added in v1.0.0
func (c *Client) TaskService() tasks.TasksClient
TaskService returns the underlying TasksClient
func (*Client) Version ¶ added in v1.0.0
Version returns the version of containerd that the client is connected to
func (*Client) VersionService ¶ added in v1.0.0
func (c *Client) VersionService() versionservice.VersionClient
VersionService returns the underlying VersionClient
type ClientOpt ¶ added in v1.0.0
type ClientOpt func(c *clientOpts) error
ClientOpt allows callers to set options on the containerd client
func WithCallOpts ¶ added in v1.6.0
func WithCallOpts(opts []grpc.CallOption) ClientOpt
WithCallOpts allows grpc.CallOptions to be set on the connection
func WithDefaultNamespace ¶ added in v1.0.0
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 WithDefaultPlatform ¶ added in v1.3.0
func WithDefaultPlatform(platform platforms.MatchComparer) ClientOpt
WithDefaultPlatform sets the default platform matcher on the client
func WithDefaultRuntime ¶ added in v1.2.0
WithDefaultRuntime sets the default runtime on the client
func WithDialOpts ¶ added in v1.0.0
func WithDialOpts(opts []grpc.DialOption) ClientOpt
WithDialOpts allows grpc.DialOptions to be set on the connection
func WithInMemoryServices ¶ added in v1.7.0
func WithInMemoryServices(ic *plugin.InitContext) ClientOpt
WithInMemoryServices is suitable for cases when there is need to use containerd's client from another (in-memory) containerd plugin (such as CRI).
func WithServices ¶ added in v1.1.0
func WithServices(opts ...ServicesOpt) ClientOpt
WithServices sets services used by the client.
func WithTimeout ¶ added in v1.2.0
WithTimeout sets the connection timeout for the client
type Container ¶ added in v1.0.0
type Container interface { // ID identifies the container ID() string // Info returns the underlying container record type Info(context.Context, ...InfoOpts) (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]typeurl.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 ¶ added in v1.0.0
DeleteOpts allows the caller to set options for the deletion of a container
type DiffService ¶ added in v1.1.0
DiffService handles the computation and application of diffs
func NewDiffServiceFromClient ¶ added in v1.0.0
func NewDiffServiceFromClient(client diffapi.DiffClient) DiffService
NewDiffServiceFromClient returns a new diff service which communicates over a GRPC connection.
type EventService ¶ added in v1.1.0
EventService handles the publish, forward and subscribe of events.
func NewEventServiceFromClient ¶ added in v1.1.0
func NewEventServiceFromClient(client eventsapi.EventsClient) EventService
NewEventServiceFromClient returns a new event service which communicates over a GRPC connection.
type ExitStatus ¶ added in v1.0.0
type ExitStatus struct {
// contains filtered or unexported fields
}
ExitStatus encapsulates a process's exit status. It is used by `Wait()` to return either a process exit code or an error
func NewExitStatus ¶ added in v1.3.0
func NewExitStatus(code uint32, t time.Time, err error) *ExitStatus
NewExitStatus populates an ExitStatus
func (ExitStatus) Error ¶ added in v1.0.0
func (s ExitStatus) Error() error
Error returns the error, if any, that occurred while waiting for the process.
func (ExitStatus) ExitCode ¶ added in v1.0.0
func (s ExitStatus) ExitCode() uint32
ExitCode returns the exit code of the process. This is only valid is Error() returns nil
func (ExitStatus) ExitTime ¶ added in v1.0.0
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 ¶ added in v1.0.0
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 IOCloseInfo ¶ added in v1.0.0
type IOCloseInfo struct {
Stdin bool
}
IOCloseInfo allows specific io pipes to be closed on a process
type IOCloserOpts ¶ added in v1.0.0
type IOCloserOpts func(*IOCloseInfo)
IOCloserOpts allows the caller to set specific pipes as closed on a process
type Image ¶ added in v1.0.0
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, ...UnpackOpt) 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) // Usage returns a usage calculation for the image. Usage(context.Context, ...UsageOpt) (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 // Metadata returns the underlying image metadata Metadata() images.Image // Platform returns the platform match comparer. Can be nil. Platform() platforms.MatchComparer // Spec returns the OCI image spec for a given image. Spec(ctx context.Context) (ocispec.Image, error) }
Image describes an image used by containers
func NewImageWithPlatform ¶ added in v1.2.0
NewImageWithPlatform returns a client image object from the metadata image
type ImportOpt ¶ added in v1.0.0
type ImportOpt func(*importOpts) error
ImportOpt allows the caller to specify import specific options
func WithAllPlatforms ¶ added in v1.3.0
WithAllPlatforms is used to import content for all platforms.
func WithDigestRef ¶ added in v1.2.0
WithDigestRef is used to create digest images for each manifest in the index.
func WithDiscardUnpackedLayers ¶ added in v1.7.0
func WithDiscardUnpackedLayers() ImportOpt
WithDiscardUnpackedLayers allows the garbage collector to clean up layers from content store after unpacking.
func WithImageRefTranslator ¶ added in v1.2.0
WithImageRefTranslator is used to translate the index reference to an image reference for the image store.
func WithImportCompression ¶ added in v1.3.0
func WithImportCompression() ImportOpt
WithImportCompression compresses uncompressed layers on import. This is used for import formats which do not include the manifest.
func WithImportPlatform ¶ added in v1.5.15
func WithImportPlatform(platformMacher platforms.MatchComparer) ImportOpt
WithImportPlatform is used to import content for specific platform.
func WithIndexName ¶ added in v1.2.0
WithIndexName creates a tag pointing to the imported index
func WithSkipDigestRef ¶ added in v1.6.0
WithSkipDigestRef is used to specify when to skip applying WithDigestRef. The callback receives an image reference (or an empty string if not specified in the image). When the callback returns true, the skip occurs.
func WithSkipMissing ¶ added in v1.7.12
func WithSkipMissing() ImportOpt
WithSkipMissing allows to import an archive which doesn't contain all the referenced blobs.
type InfoConfig ¶ added in v1.3.0
type InfoConfig struct { // Refresh will to a fetch of the latest container metadata Refresh bool }
InfoConfig specifies how container metadata is fetched
type InfoOpts ¶ added in v1.3.0
type InfoOpts func(*InfoConfig)
InfoOpts controls how container metadata is fetched and returned
type InstallConfig ¶ added in v1.2.0
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 ¶ added in v1.2.0
type InstallOpts func(*InstallConfig)
InstallOpts configures binary installs
func WithInstallPath ¶ added in v1.2.0
func WithInstallPath(path string) InstallOpts
WithInstallPath sets the optional install path
type KillInfo ¶ added in v1.0.0
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 ¶ added in v1.0.0
KillOpts allows options to be set for the killing of a process
func WithKillExecID ¶ added in v1.0.0
WithKillExecID specifies the process ID
type NewContainerOpts ¶ added in v1.0.0
NewContainerOpts allows the caller to set additional options when creating a container
func WithAdditionalContainerLabels ¶ added in v1.5.0
func WithAdditionalContainerLabels(labels map[string]string) NewContainerOpts
WithAdditionalContainerLabels adds the provided labels to the container The existing labels are preserved as long as they do not conflict with the added labels.
func WithContainerExtension ¶ added in v1.0.0
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 ¶ added in v1.0.0
func WithContainerLabels(labels map[string]string) NewContainerOpts
WithContainerLabels sets the provided labels to the container. The existing labels are cleared. Use WithAdditionalContainerLabels to preserve the existing labels.
func WithImage ¶ added in v1.0.0
func WithImage(i Image) NewContainerOpts
WithImage sets the provided image as the base for the container
func WithImageConfigLabels ¶ added in v1.5.6
func WithImageConfigLabels(image Image) NewContainerOpts
WithImageConfigLabels sets the image config labels on the container. The existing labels are cleared as this is expected to be the first operation in setting up a container's labels. Use WithAdditionalContainerLabels to add/overwrite the existing image config labels.
func WithImageName ¶ added in v1.3.0
func WithImageName(n string) NewContainerOpts
WithImageName allows setting the image name as the base for the container
func WithImageStopSignal ¶ added in v1.2.0
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 ¶ added in v1.0.0
func WithNewSnapshot(id string, i Image, opts ...snapshots.Opt) NewContainerOpts
WithNewSnapshot allocates a new snapshot to be used by the container as the root filesystem in read-write mode
func WithNewSnapshotView ¶ added in v1.0.0
func WithNewSnapshotView(id string, i Image, opts ...snapshots.Opt) NewContainerOpts
WithNewSnapshotView allocates a new snapshot to be used by the container as the root filesystem in read-only mode
func WithNewSpec ¶ added in v1.0.0
func WithNewSpec(opts ...oci.SpecOpts) NewContainerOpts
WithNewSpec generates a new spec for a new container
func WithRemappedSnapshot ¶ added in v1.0.0
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 ¶ added in v1.0.0
func WithRemappedSnapshotView(id string, i Image, uid, gid uint32) NewContainerOpts
WithRemappedSnapshotView is similar to WithRemappedSnapshot but rootfs is mounted as read-only.
func WithRestoreImage ¶ added in v1.3.0
func WithRestoreImage(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index) NewContainerOpts
WithRestoreImage restores the image for the container
func WithRestoreRW ¶ added in v1.3.0
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 ¶ added in v1.3.0
func WithRestoreRuntime(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index) NewContainerOpts
WithRestoreRuntime restores the runtime for the container
func WithRestoreSpec ¶ added in v1.3.0
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 ¶ added in v1.0.0
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 WithSandbox ¶ added in v1.7.0
func WithSandbox(sandboxID string) NewContainerOpts
WithSandbox joins the container to a container group (aka sandbox) from the given ID Note: shim runtime must support sandboxes environments.
func WithSnapshot ¶ added in v1.0.0
func WithSnapshot(id string) NewContainerOpts
WithSnapshot uses an existing root filesystem for the container
func WithSnapshotter ¶ added in v1.0.0
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.
type NewSandboxOpts ¶ added in v1.7.0
NewSandboxOpts is a sandbox options and extensions to be provided by client
func WithSandboxExtension ¶ added in v1.7.0
func WithSandboxExtension(name string, ext interface{}) NewSandboxOpts
WithSandboxExtension attaches an extension to sandbox
func WithSandboxLabels ¶ added in v1.7.0
func WithSandboxLabels(labels map[string]string) NewSandboxOpts
WithSandboxLabels attaches map of labels to sandbox
func WithSandboxRuntime ¶ added in v1.7.0
func WithSandboxRuntime(name string, options interface{}) NewSandboxOpts
WithSandboxRuntime allows a user to specify the runtime to be used to run a sandbox
func WithSandboxSpec ¶ added in v1.7.0
func WithSandboxSpec(s *oci.Spec, opts ...oci.SpecOpts) NewSandboxOpts
WithSandboxSpec will provide the sandbox runtime spec
type NewTaskOpts ¶ added in v1.0.0
NewTaskOpts allows the caller to set options on a new task
func WithGIDOwner ¶ added in v1.4.0
func WithGIDOwner(gid uint32) NewTaskOpts
WithGIDOwner allows console I/O to work with the remapped GID in user namespace
func WithRestoreImagePath ¶ added in v1.3.0
func WithRestoreImagePath(path string) NewTaskOpts
WithRestoreImagePath sets image path for create option
func WithRootFS ¶ added in v1.0.0
func WithRootFS(mounts []mount.Mount) NewTaskOpts
WithRootFS allows a task to be created without a snapshot being allocated to its container
func WithRuntimePath ¶ added in v1.6.0
func WithRuntimePath(absRuntimePath string) NewTaskOpts
WithRuntimePath will force task service to use a custom path to the runtime binary instead of resolving it from runtime name.
func WithShimCgroup ¶ added in v1.3.0
func WithShimCgroup(path string) NewTaskOpts
WithShimCgroup sets the existing cgroup for the shim
func WithTaskCheckpoint ¶ added in v1.0.0
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
func WithUIDOwner ¶ added in v1.4.0
func WithUIDOwner(uid uint32) NewTaskOpts
WithUIDOwner allows console I/O to work with the remapped UID in user namespace
type Process ¶ added in v1.0.0
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 height 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 ¶ added in v1.0.0
ProcessDeleteOpts allows the caller to set options for the deletion of a task
type ProcessInfo ¶ added in v1.0.0
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 ¶ added in v1.0.0
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 ¶ added in v1.0.0
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. // It is done simultaneously for schema 2 images when they are pulled. // If an image is not unpacked on pull, it can be unpacked any time // afterwards. Unpacking is required to run an image. Unpack bool // UnpackOpts handles options to the unpack call. UnpackOpts []UnpackOpt // Snapshotter used for unpacking Snapshotter string // SnapshotterOpts are additional options to be passed to a snapshotter during pull SnapshotterOpts []snapshots.Opt // 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 // HandlerWrapper wraps the handler which gets sent to dispatch. // Unlike BaseHandlers, this can run before and after the built // in handlers, allowing operations to run on the descriptor // after it has completed transferring. HandlerWrapper func(images.Handler) 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. // // Deprecated: use Schema 2 or OCI images. 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 // MaxConcurrentDownloads is the max concurrent content downloads for each pull. MaxConcurrentDownloads int // MaxConcurrentUploadedLayers is the max concurrent uploaded layers for each push. MaxConcurrentUploadedLayers int // AllMetadata downloads all manifests and known-configuration files AllMetadata bool // ChildLabelMap sets the labels used to reference child objects in the content // store. By default, all GC reference labels will be set for all fetched content. ChildLabelMap func(ocispec.Descriptor) []string }
RemoteContext is used to configure object resolutions and transfers with remote content stores and image providers.
type RemoteOpt ¶ added in v1.0.0
type RemoteOpt func(*Client, *RemoteContext) error
RemoteOpt allows the caller to set distribution options for a remote
func WithAllMetadata ¶ added in v1.3.0
func WithAllMetadata() RemoteOpt
WithAllMetadata downloads all manifests and known-configuration files
func WithChildLabelMap ¶ added in v1.4.0
func WithChildLabelMap(fn func(ocispec.Descriptor) []string) RemoteOpt
WithChildLabelMap sets the map function used to define the labels set on referenced child content in the content store. This can be used to overwrite the default GC labels or filter which labels get set for content. The default is `images.ChildGCLabels`.
func WithImageHandler ¶ added in v1.0.0
WithImageHandler adds a base handler to be called on dispatch.
func WithImageHandlerWrapper ¶ added in v1.3.0
WithImageHandlerWrapper wraps the handlers to be called on dispatch.
func WithMaxConcurrentDownloads ¶ added in v1.3.0
WithMaxConcurrentDownloads sets max concurrent download limit.
func WithMaxConcurrentUploadedLayers ¶ added in v1.5.0
WithMaxConcurrentUploadedLayers sets max concurrent uploaded layer limit.
func WithPlatform ¶ added in v1.1.0
WithPlatform allows the caller to specify a platform to retrieve content for
func WithPlatformMatcher ¶ added in v1.2.0
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 ¶ added in v1.0.0
WithPullLabel sets a label to be associated with a pulled reference
func WithPullLabels ¶ added in v1.0.0
WithPullLabels associates a set of labels to a pulled reference
func WithPullSnapshotter ¶ added in v1.0.0
WithPullSnapshotter specifies snapshotter name used for unpacking.
func WithResolver ¶ added in v1.0.0
WithResolver specifies the resolver to use.
func WithUnpackOpts ¶ added in v1.4.0
WithUnpackOpts is used to add unpack options to the unpacker.
type RestoreOpts ¶ added in v1.3.0
RestoreOpts are options to manage the restore operation
type Sandbox ¶ added in v1.7.0
type Sandbox interface { // ID is a sandbox identifier ID() string // PID returns sandbox's process PID or error if its not yet started. PID() (uint32, error) // NewContainer creates new container that will belong to this sandbox NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error) // Labels returns the labels set on the sandbox Labels(ctx context.Context) (map[string]string, error) // Start starts new sandbox instance Start(ctx context.Context) error // Stop sends stop request to the shim instance. Stop(ctx context.Context) error // Wait blocks until sandbox process exits. Wait(ctx context.Context) (<-chan ExitStatus, error) // Shutdown removes sandbox from the metadata store and shutdowns shim instance. Shutdown(ctx context.Context) error }
Sandbox is a high level client to containerd's sandboxes.
type ServerInfo ¶ added in v1.3.0
type ServerInfo struct {
UUID string
}
ServerInfo represents the introspected server information
type ServicesOpt ¶ added in v1.1.0
type ServicesOpt func(c *services)
ServicesOpt allows callers to set options on the services
func WithContainerClient ¶ added in v1.6.0
func WithContainerClient(containerService containersapi.ContainersClient) ServicesOpt
WithContainerClient sets the container service to use using a containers client.
func WithContainerStore ¶ added in v1.6.0
func WithContainerStore(containerStore containers.Store) ServicesOpt
WithContainerStore sets the container store.
func WithContentStore ¶ added in v1.1.0
func WithContentStore(contentStore content.Store) ServicesOpt
WithContentStore sets the content store.
func WithDiffClient ¶ added in v1.6.0
func WithDiffClient(diffService diff.DiffClient) ServicesOpt
WithDiffClient sets the diff service to use from a diff client.
func WithDiffService ¶ added in v1.1.0
func WithDiffService(diffService DiffService) ServicesOpt
WithDiffService sets the diff store.
func WithEventService ¶ added in v1.1.0
func WithEventService(eventService EventService) ServicesOpt
WithEventService sets the event service.
func WithImageClient ¶ added in v1.6.0
func WithImageClient(imageService imagesapi.ImagesClient) ServicesOpt
WithImageClient sets the image service to use using an images client.
func WithImageStore ¶ added in v1.6.0
func WithImageStore(imageStore images.Store) ServicesOpt
WithImageStore sets the image store.
func WithIntrospectionClient ¶ added in v1.6.0
func WithIntrospectionClient(in introspectionapi.IntrospectionClient) ServicesOpt
WithIntrospectionClient sets the introspection service using an introspection client.
func WithIntrospectionService ¶ added in v1.4.0
func WithIntrospectionService(in introspection.Service) ServicesOpt
WithIntrospectionService sets the introspection service.
func WithLeasesService ¶ added in v1.1.0
func WithLeasesService(leasesService leases.Manager) ServicesOpt
WithLeasesService sets the lease service.
func WithNamespaceClient ¶ added in v1.6.0
func WithNamespaceClient(namespaceService namespacesapi.NamespacesClient) ServicesOpt
WithNamespaceClient sets the namespace service using a namespaces client.
func WithNamespaceService ¶ added in v1.1.0
func WithNamespaceService(namespaceService namespaces.Store) ServicesOpt
WithNamespaceService sets the namespace service.
func WithSandboxController ¶ added in v1.7.0
func WithSandboxController(client sandbox.Controller) ServicesOpt
WithSandboxController sets the sandbox controller.
func WithSandboxStore ¶ added in v1.7.0
func WithSandboxStore(client sandbox.Store) ServicesOpt
WithSandboxStore sets the sandbox store.
func WithSnapshotters ¶ added in v1.1.0
func WithSnapshotters(snapshotters map[string]snapshots.Snapshotter) ServicesOpt
WithSnapshotters sets the snapshotters.
func WithTaskClient ¶ added in v1.6.0
func WithTaskClient(taskService tasks.TasksClient) ServicesOpt
WithTaskClient sets the task service to use from a tasks client.
type Status ¶ added in v1.0.0
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 ¶ added in v1.0.0
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 pushed and pulled from a remote resource. // // Additional software like CRIU maybe required to checkpoint and restore tasks // NOTE: Checkpoint supports to dump task information to a directory, in this way, // an empty OCI Index will be returned. 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) // Spec returns the current OCI specification for the task Spec(context.Context) (*oci.Spec, error) }
Task is the executable object within containerd
type TaskInfo ¶ added in v1.0.0
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{} // RuntimePath is an absolute path that can be used to overwrite path // to a shim runtime binary. RuntimePath string // contains filtered or unexported fields }
TaskInfo sets options for task creation
type UnpackConfig ¶ added in v1.3.0
type UnpackConfig struct { // ApplyOpts for applying a diff to a snapshotter ApplyOpts []diff.ApplyOpt // SnapshotOpts for configuring a snapshotter SnapshotOpts []snapshots.Opt // CheckPlatformSupported is whether to validate that a snapshotter // supports an image's platform before unpacking CheckPlatformSupported bool // DuplicationSuppressor is used to make sure that there is only one // in-flight fetch request or unpack handler for a given descriptor's // digest or chain ID. DuplicationSuppressor kmutex.KeyedLocker }
UnpackConfig provides configuration for the unpack of an image
type UnpackOpt ¶ added in v1.3.0
type UnpackOpt func(context.Context, *UnpackConfig) error
UnpackOpt provides configuration for unpack
func WithSnapshotterPlatformCheck ¶ added in v1.5.0
func WithSnapshotterPlatformCheck() UnpackOpt
WithSnapshotterPlatformCheck sets `CheckPlatformSupported` on the UnpackConfig
func WithUnpackApplyOpts ¶ added in v1.7.14
WithUnpackApplyOpts appends new apply options on the UnpackConfig.
func WithUnpackDuplicationSuppressor ¶ added in v1.6.3
func WithUnpackDuplicationSuppressor(suppressor kmutex.KeyedLocker) UnpackOpt
WithUnpackDuplicationSuppressor sets `DuplicationSuppressor` on the UnpackConfig.
type UpdateContainerOpts ¶ added in v1.0.0
UpdateContainerOpts allows the caller to set additional options when updating a container
type UpdateTaskInfo ¶ added in v1.0.0
type UpdateTaskInfo struct { // Resources updates a tasks resource constraints Resources interface{} // Annotations allows arbitrary and/or experimental resource constraints for task update Annotations map[string]string }
UpdateTaskInfo allows updated specific settings to be changed on a task
type UpdateTaskOpts ¶ added in v1.0.0
type UpdateTaskOpts func(context.Context, *Client, *UpdateTaskInfo) error
UpdateTaskOpts allows a caller to update task settings
func WithAnnotations ¶ added in v1.5.0
func WithAnnotations(annotations map[string]string) UpdateTaskOpts
WithAnnotations sets the provided annotations for task updates.
func WithResources ¶ added in v1.0.0
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 UsageOpt ¶ added in v1.3.0
type UsageOpt func(*usageOptions) error
UsageOpt is used to configure the usage calculation
func WithManifestUsage ¶ added in v1.3.0
func WithManifestUsage() UsageOpt
WithManifestUsage is used to get the usage for an image based on what is reported by the manifests rather than what exists in the content store. NOTE: This function is best used with the manifest limit set to get a consistent value, otherwise non-existent manifests will be excluded.
func WithSnapshotUsage ¶ added in v1.3.0
func WithSnapshotUsage() UsageOpt
WithSnapshotUsage will check for referenced snapshots from the image objects and include the snapshot size in the total usage.
func WithUsageManifestLimit ¶ added in v1.3.0
WithUsageManifestLimit sets the limit to the number of manifests which will be walked for usage. Setting this value to 0 will require all manifests to be walked, returning ErrNotFound if manifests are missing. NOTE: By default all manifests which exist will be walked and any non-existent manifests and their subobjects will be ignored.
Source 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
- pull.go
- sandbox.go
- services.go
- signals.go
- snapshotter_default_linux.go
- snapshotter_opts_unix.go
- task.go
- task_opts.go
- task_opts_unix.go
- transfer.go
Directories ¶
Path | Synopsis |
---|---|
api
module
|
|
cmd
|
|
contrib
|
|
Package defaults provides several common defaults for interacting with containerd.
|
Package defaults provides several common defaults for interacting with containerd. |
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. |
archive
Package archive provides a Docker and OCI compatible importer
|
Package archive provides a Docker and OCI compatible importer |
converter
Package converter provides image converter
|
Package converter provides image converter |
remote
Package remote contains gRPC implementation of internalapi.RuntimeService and internalapi.ImageManagerService.
|
Package remote contains gRPC implementation of internalapi.RuntimeService and internalapi.ImageManagerService. |
client
Module
|
|
Package metadata stores all labels and object specific metadata by namespace.
|
Package metadata stores all labels and object specific metadata by namespace. |
pkg
|
|
atomicfile
Package atomicfile provides a mechanism (on Unix-like platforms) to present a consistent view of a file to separate processes even while the file is being written.
|
Package atomicfile provides a mechanism (on Unix-like platforms) to present a consistent view of a file to separate processes even while the file is being written. |
cap
Package cap provides Linux capability utility
|
Package cap provides Linux capability utility |
cleanup
Package providing utilies to help cleanup
|
Package providing utilies to help cleanup |
cri/server/bandwidth
Package bandwidth provides utilities for bandwidth shaping
|
Package bandwidth provides utilities for bandwidth shaping |
cri/streaming/portforward
Package portforward contains server-side logic for handling port forwarding requests.
|
Package portforward contains server-side logic for handling port forwarding requests. |
cri/streaming/remotecommand
Package remotecommand contains functions related to executing commands in and attaching to pods.
|
Package remotecommand contains functions related to executing commands in and attaching to pods. |
epoch
Package epoch provides SOURCE_DATE_EPOCH utilities.
|
Package epoch provides SOURCE_DATE_EPOCH utilities. |
failpoint
Package failpoint provides the code point in the path, which can be controlled by user's variable.
|
Package failpoint provides the code point in the path, which can be controlled by user's variable. |
fifosync
Package fifosync provides a pattern on Unix-like operating systems for synchronizing across processes using Unix FIFOs (named pipes).
|
Package fifosync provides a pattern on Unix-like operating systems for synchronizing across processes using Unix FIFOs (named pipes). |
kmutex
Package kmutex provides synchronization primitives to lock/unlock resource by unique key.
|
Package kmutex provides synchronization primitives to lock/unlock resource by unique key. |
progress
Package progress assists in displaying human readable progress information.
|
Package progress assists in displaying human readable progress information. |
randutil
Package randutil provides utilities for cyrpto/rand.
|
Package randutil provides utilities for cyrpto/rand. |
seed
Package seed provides an initializer for the global math/rand seed.
|
Package seed provides an initializer for the global math/rand seed. |
truncindex
Package truncindex provides a general 'index tree', used by Docker in order to be able to reference containers by only a few unambiguous characters of their id.
|
Package truncindex provides a general 'index tree', used by Docker in order to be able to reference containers by only a few unambiguous characters of their id. |
userns
Deprecated: use github.com/moby/sys/userns
|
Deprecated: use github.com/moby/sys/userns |
plugins
|
|
proto
Package proto provides convinient aliases that make google.golang.org/protobuf migration easier.
|
Package proto provides convinient aliases that make google.golang.org/protobuf migration easier. |
types
Package types provides convinient aliases that make google.golang.org/protobuf migration easier.
|
Package types provides convinient aliases that make google.golang.org/protobuf migration easier. |
docker
Package docker is deprecated, and has moved to github.com/distribution/reference.
|
Package docker is deprecated, and has moved to github.com/distribution/reference. |
docker/config
Package config contains utilities for helping configure the Docker resolver
|
Package config contains utilities for helping configure the Docker resolver |
docker/schema1
Package schema1 provides a converter to fetch an image formatted in Docker Image Manifest v2, Schema 1.
|
Package schema1 provides a converter to fetch an image formatted in Docker Image Manifest v2, Schema 1. |
restart
Package restart enables containers to have labels added and monitored to keep the container's task running if it is killed.
|
Package restart enables containers to have labels added and monitored to keep the container's task running if it is killed. |
v1/shim/v1
Code generated by protoc-gen-go-ttrpc.
|
Code generated by protoc-gen-go-ttrpc. |
storage
Package storage provides a metadata storage implementation for snapshot drivers.
|
Package storage provides a metadata storage implementation for snapshot drivers. |
third_party
|
|