{"modulePath":"github.com/laincloud/containerd","version":"v1.2.4","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package containerd\n\n## Constants\n\n```go\nconst (\n\t// DefaultSnapshotter will set the default snapshotter for the platform.\n\t// This will be based on the client compilation target, so take that into\n\t// account when choosing this value.\n\tDefaultSnapshotter = \"overlayfs\"\n)\n```\n\n```go\nconst StopSignalLabel = \"io.containerd.image.config.stop-signal\"\n```\nStopSignalLabel is a well-known containerd label for storing the stop signal specified in the OCI image config\n\n```go\nconst UnknownExitStatus = 255\n```\nUnknownExitStatus 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.\n\n## Functions\n\n```go\nfunc GetOCIStopSignal(ctx context.Context, image Image, defaultSignal string) (string, error)\n```\nGetOCIStopSignal retrieves the stop signal specified in the OCI image config\n\n```go\nfunc GetStopSignal(ctx context.Context, container Container, defaultSignal syscall.Signal) (syscall.Signal, error)\n```\nGetStopSignal retrieves the container stop signal, specified by the well-known containerd label (StopSignalLabel)\n\n```go\nfunc NewImageStoreFromClient(client imagesapi.ImagesClient) images.Store\n```\nNewImageStoreFromClient returns a new image store client\n\n```go\nfunc NewNamespaceStoreFromClient(client api.NamespacesClient) namespaces.Store\n```\nNewNamespaceStoreFromClient returns a new namespace store\n\n```go\nfunc NewRemoteContainerStore(client containersapi.ContainersClient) containers.Store\n```\nNewRemoteContainerStore returns the container Store connected with the provided client\n\n```go\nfunc ParseSignal(rawSignal string) (syscall.Signal, error)\n```\nParseSignal parses a given string into a syscall.Signal it checks that the signal exists in the platform-appropriate signalMap\n\n```go\nfunc WithInstallLibs(c *InstallConfig)\n```\nWithInstallLibs installs libs from the image\n\n```go\nfunc WithInstallReplace(c *InstallConfig)\n```\nWithInstallReplace will replace existing files\n\n```go\nfunc WithKillAll(ctx context.Context, i *KillInfo) error\n```\nWithKillAll kills all processes for a task\n\n```go\nfunc WithNoNewKeyring(ctx context.Context, c *Client, ti *TaskInfo) error\n```\nWithNoNewKeyring 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\n\n```go\nfunc WithNoPivotRoot(_ context.Context, _ *Client, info *TaskInfo) error\n```\nWithNoPivotRoot instructs the runtime not to you pivot\\_root\n\n```go\nfunc WithProcessKill(ctx context.Context, p Process) error\n```\nWithProcessKill will forcefully kill and delete a process\n\n```go\nfunc WithPullUnpack(_ *Client, c *RemoteContext) error\n```\nWithPullUnpack is used to unpack an image after pull. This uses the snapshotter, content store, and diff service configured for the client.\n\n```go\nfunc WithSchema1Conversion(client *Client, c *RemoteContext) error\n```\nWithSchema1Conversion 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.\n\n```go\nfunc WithSnapshotCleanup(ctx context.Context, client *Client, c containers.Container) error\n```\nWithSnapshotCleanup deletes the rootfs snapshot allocated for the container\n\n```go\nfunc WithStdinCloser(r *IOCloseInfo)\n```\nWithStdinCloser closes the stdin of a process\n\n## Types\n\n```go\ntype CheckpointTaskInfo struct {\n\tName string\n\t// ParentCheckpoint is the digest of a parent checkpoint\n\tParentCheckpoint digest.Digest\n\t// Options hold runtime specific settings for checkpointing a task\n\tOptions interface{}\n}\n```\nCheckpointTaskInfo allows specific checkpoint information to be set for the task\n\n```go\ntype CheckpointTaskOpts func(*CheckpointTaskInfo) error\n```\nCheckpointTaskOpts allows the caller to set checkpoint options\n\n```go\nfunc WithCheckpointName(name string) CheckpointTaskOpts\n```\nWithCheckpointName sets the image name for the checkpoint\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\nClient is the client to interact with containerd and its various services using a uniform interface\n\n```go\nfunc New(address string, opts ...ClientOpt) (*Client, error)\n```\nNew returns a new containerd client that is connected to the containerd instance provided by address\n\n```go\nfunc NewWithConn(conn *grpc.ClientConn, opts ...ClientOpt) (*Client, error)\n```\nNewWithConn returns a new containerd client that is connected to the containerd instance provided by the connection\n\n```go\nfunc (c *Client) Close() error\n```\nClose closes the clients connection to containerd\n\n```go\nfunc (c *Client) ContainerService() containers.Store\n```\nContainerService returns the underlying container Store\n\n```go\nfunc (c *Client) Containers(ctx context.Context, filters ...string) ([]Container, error)\n```\nContainers returns all containers created in containerd\n\n```go\nfunc (c *Client) ContentStore() content.Store\n```\nContentStore returns the underlying content Store\n\n```go\nfunc (c *Client) DiffService() DiffService\n```\nDiffService returns the underlying Differ\n\n```go\nfunc (c *Client) EventService() EventService\n```\nEventService returns the underlying event service\n\n```go\nfunc (c *Client) Export(ctx context.Context, exporter images.Exporter, desc ocispec.Descriptor, opts ...ExportOpt) (io.ReadCloser, error)\n```\nExport 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.\n\n```go\nfunc (c *Client) Fetch(ctx context.Context, ref string, opts ...RemoteOpt) (images.Image, error)\n```\nFetch downloads the provided content into containerd's content store and returns a non-platform specific image reference\n\n```go\nfunc (c *Client) GetImage(ctx context.Context, ref string) (Image, error)\n```\nGetImage returns an existing image\n\n```go\nfunc (c *Client) HealthService() grpc_health_v1.HealthClient\n```\nHealthService returns the underlying GRPC HealthClient\n\n```go\nfunc (c *Client) ImageService() images.Store\n```\nImageService returns the underlying image Store\n\n```go\nfunc (c *Client) Import(ctx context.Context, reader io.Reader, opts ...ImportOpt) ([]images.Image, error)\n```\nImport 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.\n\n```go\nfunc (c *Client) Install(ctx context.Context, image Image, opts ...InstallOpts) error\n```\nInstall a binary image into the opt service\n\n```go\nfunc (c *Client) IntrospectionService() introspectionapi.IntrospectionClient\n```\nIntrospectionService returns the underlying Introspection Client\n\n```go\nfunc (c *Client) IsServing(ctx context.Context) (bool, error)\n```\nIsServing 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.\n\n```go\nfunc (c *Client) LeasesService() leases.Manager\n```\nLeasesService returns the underlying Leases Client\n\n```go\nfunc (c *Client) ListImages(ctx context.Context, filters ...string) ([]Image, error)\n```\nListImages returns all existing images\n\n```go\nfunc (c *Client) LoadContainer(ctx context.Context, id string) (Container, error)\n```\nLoadContainer loads an existing container from metadata\n\n```go\nfunc (c *Client) NamespaceService() namespaces.Store\n```\nNamespaceService returns the underlying Namespaces Store\n\n```go\nfunc (c *Client) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error)\n```\nNewContainer will create a new container in container with the provided id the id must be unique within the namespace\n\n```go\nfunc (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpt) (Image, error)\n```\nPull downloads the provided content into containerd's content store and returns a platform specific image object\n\n```go\nfunc (c *Client) Push(ctx context.Context, ref string, desc ocispec.Descriptor, opts ...RemoteOpt) error\n```\nPush uploads the provided content to a remote resource\n\n```go\nfunc (c *Client) Reconnect() error\n```\nReconnect re-establishes the GRPC connection to the containerd daemon\n\n```go\nfunc (c *Client) SnapshotService(snapshotterName string) snapshots.Snapshotter\n```\nSnapshotService returns the underlying snapshotter for the provided snapshotter name\n\n```go\nfunc (c *Client) Subscribe(ctx context.Context, filters ...string) (ch \u003c-chan *events.Envelope, errs \u003c-chan error)\n```\nSubscribe to events that match one or more of the provided filters.\n\nCallers should listen on both the envelope and errs channels. If the errs channel returns nil or an error, the subscriber should terminate.\n\nThe subscriber can stop receiving events by canceling the provided context. The errs channel will be closed and return a nil error.\n\n```go\nfunc (c *Client) TaskService() tasks.TasksClient\n```\nTaskService returns the underlying TasksClient\n\n```go\nfunc (c *Client) Version(ctx context.Context) (Version, error)\n```\nVersion returns the version of containerd that the client is connected to\n\n```go\nfunc (c *Client) VersionService() versionservice.VersionClient\n```\nVersionService returns the underlying VersionClient\n\n```go\nfunc (c *Client) WithLease(ctx context.Context) (context.Context, func(context.Context) error, error)\n```\nWithLease attaches a lease on the context\n\n```go\ntype ClientOpt func(c *clientOpts) error\n```\nClientOpt allows callers to set options on the containerd client\n\n```go\nfunc WithDefaultNamespace(ns string) ClientOpt\n```\nWithDefaultNamespace sets the default namespace on the client\n\nAny operation that does not have a namespace set on the context will be provided the default namespace\n\n```go\nfunc WithDefaultRuntime(rt string) ClientOpt\n```\nWithDefaultRuntime sets the default runtime on the client\n\n```go\nfunc WithDialOpts(opts []grpc.DialOption) ClientOpt\n```\nWithDialOpts allows grpc.DialOptions to be set on the connection\n\n```go\nfunc WithServices(opts ...ServicesOpt) ClientOpt\n```\nWithServices sets services used by the client.\n\n```go\nfunc WithTimeout(d time.Duration) ClientOpt\n```\nWithTimeout sets the connection timeout for the client\n\n```go\ntype Container interface {\n\t// ID identifies the container\n\tID() string\n\t// Info returns the underlying container record type\n\tInfo(context.Context) (containers.Container, error)\n\t// Delete removes the container\n\tDelete(context.Context, ...DeleteOpts) error\n\t// NewTask creates a new task based on the container metadata\n\tNewTask(context.Context, cio.Creator, ...NewTaskOpts) (Task, error)\n\t// Spec returns the OCI runtime specification\n\tSpec(context.Context) (*oci.Spec, error)\n\t// Task returns the current task for the container\n\t//\n\t// If cio.Attach options are passed the client will reattach to the IO for the running\n\t// task. If no task exists for the container a NotFound error is returned\n\t//\n\t// Clients must make sure that only one reader is attached to the task and consuming\n\t// the output from the task's fifos\n\tTask(context.Context, cio.Attach) (Task, error)\n\t// Image returns the image that the container is based on\n\tImage(context.Context) (Image, error)\n\t// Labels returns the labels set on the container\n\tLabels(context.Context) (map[string]string, error)\n\t// SetLabels sets the provided labels for the container and returns the final label set\n\tSetLabels(context.Context, map[string]string) (map[string]string, error)\n\t// Extensions returns the extensions set on the container\n\tExtensions(context.Context) (map[string]prototypes.Any, error)\n\t// Update a container\n\tUpdate(context.Context, ...UpdateContainerOpts) error\n}\n```\nContainer is a metadata object for container resources and task creation\n\n```go\ntype DeleteOpts func(ctx context.Context, client *Client, c containers.Container) error\n```\nDeleteOpts allows the caller to set options for the deletion of a container\n\n```go\ntype DiffService interface {\n\tdiff.Comparer\n\tdiff.Applier\n}\n```\nDiffService handles the computation and application of diffs\n\n```go\nfunc NewDiffServiceFromClient(client diffapi.DiffClient) DiffService\n```\nNewDiffServiceFromClient returns a new diff service which communicates over a GRPC connection.\n\n```go\ntype EventService interface {\n\tevents.Publisher\n\tevents.Forwarder\n\tevents.Subscriber\n}\n```\nEventService handles the publish, forward and subscribe of events.\n\n```go\nfunc NewEventServiceFromClient(client eventsapi.EventsClient) EventService\n```\nNewEventServiceFromClient returns a new event service which communicates over a GRPC connection.\n\n```go\ntype ExitStatus struct {\n\t// contains filtered or unexported fields\n}\n```\nExitStatus encapsulates a process' exit status. It is used by \\`Wait()\\` to return either a process exit code or an error\n\n```go\nfunc (s ExitStatus) Error() error\n```\nError returns the error, if any, that occurred while waiting for the process.\n\n```go\nfunc (s ExitStatus) ExitCode() uint32\n```\nExitCode returns the exit code of the process. This is only valid is Error() returns nil\n\n```go\nfunc (s ExitStatus) ExitTime() time.Time\n```\nExitTime returns the exit time of the process This is only valid is Error() returns nil\n\n```go\nfunc (s ExitStatus) Result() (uint32, time.Time, error)\n```\nResult returns the exit code and time of the exit status. An error may be returned here to which indicates there was an error\n\n\tat some point while waiting for the exit status. It does not signify\n\tan error with the process itself.\n\nIf an error is returned, the process may still be running.\n\n```go\ntype ExportOpt func(c *exportOpts) error\n```\nExportOpt allows the caller to specify export-specific options\n\n```go\ntype IOCloseInfo struct {\n\tStdin bool\n}\n```\nIOCloseInfo allows specific io pipes to be closed on a process\n\n```go\ntype IOCloserOpts func(*IOCloseInfo)\n```\nIOCloserOpts allows the caller to set specific pipes as closed on a process\n\n```go\ntype Image interface {\n\t// Name of the image\n\tName() string\n\t// Target descriptor for the image content\n\tTarget() ocispec.Descriptor\n\t// Labels of the image\n\tLabels() map[string]string\n\t// Unpack unpacks the image's content into a snapshot\n\tUnpack(context.Context, string) error\n\t// RootFS returns the unpacked diffids that make up images rootfs.\n\tRootFS(ctx context.Context) ([]digest.Digest, error)\n\t// Size returns the total size of the image's packed resources.\n\tSize(ctx context.Context) (int64, error)\n\t// Config descriptor for the image.\n\tConfig(ctx context.Context) (ocispec.Descriptor, error)\n\t// IsUnpacked returns whether or not an image is unpacked.\n\tIsUnpacked(context.Context, string) (bool, error)\n\t// ContentStore provides a content store which contains image blob data\n\tContentStore() content.Store\n}\n```\nImage describes an image used by containers\n\n```go\nfunc NewImage(client *Client, i images.Image) Image\n```\nNewImage returns a client image object from the metadata image\n\n```go\nfunc NewImageWithPlatform(client *Client, i images.Image, platform platforms.MatchComparer) Image\n```\nNewImageWithPlatform returns a client image object from the metadata image\n\n```go\ntype ImportOpt func(*importOpts) error\n```\nImportOpt allows the caller to specify import specific options\n\n```go\nfunc WithDigestRef(f func(digest.Digest) string) ImportOpt\n```\nWithDigestRef is used to create digest images for each manifest in the index.\n\n```go\nfunc WithImageRefTranslator(f func(string) string) ImportOpt\n```\nWithImageRefTranslator is used to translate the index reference to an image reference for the image store.\n\n```go\nfunc WithIndexName(name string) ImportOpt\n```\nWithIndexName creates a tag pointing to the imported index\n\n```go\ntype InstallConfig struct {\n\t// Libs installs libs from the image\n\tLibs bool\n\t// Replace will overwrite existing binaries or libs in the opt directory\n\tReplace bool\n\t// Path to install libs and binaries to\n\tPath string\n}\n```\nInstallConfig sets the binary install configuration\n\n```go\ntype InstallOpts func(*InstallConfig)\n```\nInstallOpts configures binary installs\n\n```go\nfunc WithInstallPath(path string) InstallOpts\n```\nWithInstallPath sets the optional install path\n\n```go\ntype KillInfo struct {\n\t// All kills all processes inside the task\n\t// only valid on tasks, ignored on processes\n\tAll bool\n\t// ExecID is the ID of a process to kill\n\tExecID string\n}\n```\nKillInfo contains information on how to process a Kill action\n\n```go\ntype KillOpts func(context.Context, *KillInfo) error\n```\nKillOpts allows options to be set for the killing of a process\n\n```go\nfunc WithKillExecID(execID string) KillOpts\n```\nWithKillExecID specifies the process ID\n\n```go\ntype NewContainerOpts func(ctx context.Context, client *Client, c *containers.Container) error\n```\nNewContainerOpts allows the caller to set additional options when creating a container\n\n```go\nfunc WithCheckpoint(im Image, snapshotKey string) NewContainerOpts\n```\nWithCheckpoint allows a container to be created from the checkpointed information provided by the descriptor. The image, snapshot, and runtime specifications are restored on the container\n\n```go\nfunc WithContainerExtension(name string, extension interface{}) NewContainerOpts\n```\nWithContainerExtension appends extension data to the container object. Use this to decorate the container object with additional data for the client integration.\n\nMake sure to register the type of \\`extension\\` in the typeurl package via \\`typeurl.Register\\` or container creation may fail.\n\n```go\nfunc WithContainerLabels(labels map[string]string) NewContainerOpts\n```\nWithContainerLabels adds the provided labels to the container\n\n```go\nfunc WithImage(i Image) NewContainerOpts\n```\nWithImage sets the provided image as the base for the container\n\n```go\nfunc WithImageStopSignal(image Image, defaultSignal string) NewContainerOpts\n```\nWithImageStopSignal sets a well-known containerd label (StopSignalLabel) on the container for storing the stop signal specified in the OCI image config\n\n```go\nfunc WithNewSnapshot(id string, i Image) NewContainerOpts\n```\nWithNewSnapshot allocates a new snapshot to be used by the container as the root filesystem in read-write mode\n\n```go\nfunc WithNewSnapshotView(id string, i Image) NewContainerOpts\n```\nWithNewSnapshotView allocates a new snapshot to be used by the container as the root filesystem in read-only mode\n\n```go\nfunc WithNewSpec(opts ...oci.SpecOpts) NewContainerOpts\n```\nWithNewSpec generates a new spec for a new container\n\n```go\nfunc WithRemappedSnapshot(id string, i Image, uid, gid uint32) NewContainerOpts\n```\nWithRemappedSnapshot creates a new snapshot and remaps the uid/gid for the filesystem to be used by a container with user namespaces\n\n```go\nfunc WithRemappedSnapshotView(id string, i Image, uid, gid uint32) NewContainerOpts\n```\nWithRemappedSnapshotView is similar to WithRemappedSnapshot but rootfs is mounted as read-only.\n\n```go\nfunc WithRuntime(name string, options interface{}) NewContainerOpts\n```\nWithRuntime allows a user to specify the runtime name and additional options that should be used to create tasks for the container\n\n```go\nfunc WithSnapshot(id string) NewContainerOpts\n```\nWithSnapshot uses an existing root filesystem for the container\n\n```go\nfunc WithSnapshotter(name string) NewContainerOpts\n```\nWithSnapshotter sets the provided snapshotter for use by the container\n\nThis option must appear before other snapshotter options to have an effect.\n\n```go\nfunc WithSpec(s *oci.Spec, opts ...oci.SpecOpts) NewContainerOpts\n```\nWithSpec sets the provided spec on the container\n\n```go\ntype NewTaskOpts func(context.Context, *Client, *TaskInfo) error\n```\nNewTaskOpts allows the caller to set options on a new task\n\n```go\nfunc WithRootFS(mounts []mount.Mount) NewTaskOpts\n```\nWithRootFS allows a task to be created without a snapshot being allocated to its container\n\n```go\nfunc WithTaskCheckpoint(im Image) NewTaskOpts\n```\nWithTaskCheckpoint 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\n\n```go\ntype Process interface {\n\t// ID of the process\n\tID() string\n\t// Pid is the system specific process id\n\tPid() uint32\n\t// Start starts the process executing the user's defined binary\n\tStart(context.Context) error\n\t// Delete removes the process and any resources allocated returning the exit status\n\tDelete(context.Context, ...ProcessDeleteOpts) (*ExitStatus, error)\n\t// Kill sends the provided signal to the process\n\tKill(context.Context, syscall.Signal, ...KillOpts) error\n\t// Wait asynchronously waits for the process to exit, and sends the exit code to the returned channel\n\tWait(context.Context) (\u003c-chan ExitStatus, error)\n\t// CloseIO allows various pipes to be closed on the process\n\tCloseIO(context.Context, ...IOCloserOpts) error\n\t// Resize changes the width and heigh of the process's terminal\n\tResize(ctx context.Context, w, h uint32) error\n\t// IO returns the io set for the process\n\tIO() cio.IO\n\t// Status returns the executing status of the process\n\tStatus(context.Context) (Status, error)\n}\n```\nProcess represents a system process\n\n```go\ntype ProcessDeleteOpts func(context.Context, Process) error\n```\nProcessDeleteOpts allows the caller to set options for the deletion of a task\n\n```go\ntype ProcessInfo struct {\n\t// Pid is the process ID\n\tPid uint32\n\t// Info includes additional process information\n\t// Info varies by platform\n\tInfo *google_protobuf.Any\n}\n```\nProcessInfo provides platform specific process information\n\n```go\ntype ProcessStatus string\n```\nProcessStatus returns a human readable status for the Process representing its current status\n\n```go\nconst (\n\t// Running indicates the process is currently executing\n\tRunning ProcessStatus = \"running\"\n\t// Created indicates the process has been created within containerd but the\n\t// user's defined process has not started\n\tCreated ProcessStatus = \"created\"\n\t// Stopped indicates that the process has ran and exited\n\tStopped ProcessStatus = \"stopped\"\n\t// Paused indicates that the process is currently paused\n\tPaused ProcessStatus = \"paused\"\n\t// Pausing indicates that the process is currently switching from a\n\t// running state into a paused state\n\tPausing ProcessStatus = \"pausing\"\n\t// Unknown indicates that we could not determine the status from the runtime\n\tUnknown ProcessStatus = \"unknown\"\n)\n```\n\n```go\ntype RemoteContext struct {\n\t// Resolver is used to resolve names to objects, fetchers, and pushers.\n\t// If no resolver is provided, defaults to Docker registry resolver.\n\tResolver remotes.Resolver\n\n\t// PlatformMatcher is used to match the platforms for an image\n\t// operation and define the preference when a single match is required\n\t// from multiple platforms.\n\tPlatformMatcher platforms.MatchComparer\n\n\t// Unpack is done after an image is pulled to extract into a snapshotter.\n\t// If an image is not unpacked on pull, it can be unpacked any time\n\t// afterwards. Unpacking is required to run an image.\n\tUnpack bool\n\n\t// Snapshotter used for unpacking\n\tSnapshotter string\n\n\t// Labels to be applied to the created image\n\tLabels map[string]string\n\n\t// BaseHandlers are a set of handlers which get are called on dispatch.\n\t// These handlers always get called before any operation specific\n\t// handlers.\n\tBaseHandlers []images.Handler\n\n\t// ConvertSchema1 is whether to convert Docker registry schema 1\n\t// manifests. If this option is false then any image which resolves\n\t// to schema 1 will return an error since schema 1 is not supported.\n\tConvertSchema1 bool\n\n\t// Platforms defines which platforms to handle when doing the image operation.\n\t// Platforms is ignored when a PlatformMatcher is set, otherwise the\n\t// platforms will be used to create a PlatformMatcher with no ordering\n\t// preference.\n\tPlatforms []string\n}\n```\nRemoteContext is used to configure object resolutions and transfers with remote content stores and image providers.\n\n```go\ntype RemoteOpt func(*Client, *RemoteContext) error\n```\nRemoteOpt allows the caller to set distribution options for a remote\n\n```go\nfunc WithImageHandler(h images.Handler) RemoteOpt\n```\nWithImageHandler adds a base handler to be called on dispatch.\n\n```go\nfunc WithPlatform(platform string) RemoteOpt\n```\nWithPlatform allows the caller to specify a platform to retrieve content for\n\n```go\nfunc WithPlatformMatcher(m platforms.MatchComparer) RemoteOpt\n```\nWithPlatformMatcher specifies the matcher to use for determining which platforms to pull content for. This value supersedes anything set with \\`WithPlatform\\`.\n\n```go\nfunc WithPullLabel(key, value string) RemoteOpt\n```\nWithPullLabel sets a label to be associated with a pulled reference\n\n```go\nfunc WithPullLabels(labels map[string]string) RemoteOpt\n```\nWithPullLabels associates a set of labels to a pulled reference\n\n```go\nfunc WithPullSnapshotter(snapshotterName string) RemoteOpt\n```\nWithPullSnapshotter specifies snapshotter name used for unpacking\n\n```go\nfunc WithResolver(resolver remotes.Resolver) RemoteOpt\n```\nWithResolver specifies the resolver to use.\n\n```go\ntype ServicesOpt func(c *services)\n```\nServicesOpt allows callers to set options on the services\n\n```go\nfunc WithContainerService(containerService containersapi.ContainersClient) ServicesOpt\n```\nWithContainerService sets the container service.\n\n```go\nfunc WithContentStore(contentStore content.Store) ServicesOpt\n```\nWithContentStore sets the content store.\n\n```go\nfunc WithDiffService(diffService diff.DiffClient) ServicesOpt\n```\nWithDiffService sets the diff service.\n\n```go\nfunc WithEventService(eventService EventService) ServicesOpt\n```\nWithEventService sets the event service.\n\n```go\nfunc WithImageService(imageService imagesapi.ImagesClient) ServicesOpt\n```\nWithImageService sets the image service.\n\n```go\nfunc WithLeasesService(leasesService leases.Manager) ServicesOpt\n```\nWithLeasesService sets the lease service.\n\n```go\nfunc WithNamespaceService(namespaceService namespacesapi.NamespacesClient) ServicesOpt\n```\nWithNamespaceService sets the namespace service.\n\n```go\nfunc WithSnapshotters(snapshotters map[string]snapshots.Snapshotter) ServicesOpt\n```\nWithSnapshotters sets the snapshotters.\n\n```go\nfunc WithTaskService(taskService tasks.TasksClient) ServicesOpt\n```\nWithTaskService sets the task service.\n\n```go\ntype Status struct {\n\t// Status of the process\n\tStatus ProcessStatus\n\t// ExitStatus returned by the process\n\tExitStatus uint32\n\t// ExitedTime is the time at which the process died\n\tExitTime time.Time\n}\n```\nStatus returns process status and exit information\n\n```go\ntype Task interface {\n\tProcess\n\n\t// Pause suspends the execution of the task\n\tPause(context.Context) error\n\t// Resume the execution of the task\n\tResume(context.Context) error\n\t// Exec creates a new process inside the task\n\tExec(context.Context, string, *specs.Process, cio.Creator) (Process, error)\n\t// Pids returns a list of system specific process ids inside the task\n\tPids(context.Context) ([]ProcessInfo, error)\n\t// Checkpoint serializes the runtime and memory information of a task into an\n\t// OCI Index that can be push and pulled from a remote resource.\n\t//\n\t// Additional software like CRIU maybe required to checkpoint and restore tasks\n\tCheckpoint(context.Context, ...CheckpointTaskOpts) (Image, error)\n\t// Update modifies executing tasks with updated settings\n\tUpdate(context.Context, ...UpdateTaskOpts) error\n\t// LoadProcess loads a previously created exec'd process\n\tLoadProcess(context.Context, string, cio.Attach) (Process, error)\n\t// Metrics returns task metrics for runtime specific metrics\n\t//\n\t// The metric types are generic to containerd and change depending on the runtime\n\t// For the built in Linux runtime, github.com/containerd/cgroups.Metrics\n\t// are returned in protobuf format\n\tMetrics(context.Context) (*types.Metric, error)\n}\n```\nTask is the executable object within containerd\n\n```go\ntype TaskInfo struct {\n\t// Checkpoint is the Descriptor for an existing checkpoint that can be used\n\t// to restore a task's runtime and memory state\n\tCheckpoint *types.Descriptor\n\t// RootFS is a list of mounts to use as the task's root filesystem\n\tRootFS []mount.Mount\n\t// Options hold runtime specific settings for task creation\n\tOptions interface{}\n}\n```\nTaskInfo sets options for task creation\n\n```go\ntype UpdateContainerOpts func(ctx context.Context, client *Client, c *containers.Container) error\n```\nUpdateContainerOpts allows the caller to set additional options when updating a container\n\n```go\ntype UpdateTaskInfo struct {\n\t// Resources updates a tasks resource constraints\n\tResources interface{}\n}\n```\nUpdateTaskInfo allows updated specific settings to be changed on a task\n\n```go\ntype UpdateTaskOpts func(context.Context, *Client, *UpdateTaskInfo) error\n```\nUpdateTaskOpts allows a caller to update task settings\n\n```go\nfunc WithResources(resources interface{}) UpdateTaskOpts\n```\nWithResources sets the provided resources for task updates. Resources must be either a \\*specs.LinuxResources or a \\*specs.WindowsResources\n\n```go\ntype Version struct {\n\t// Version number\n\tVersion string\n\t// Revision from git that was built\n\tRevision string\n}\n```\nVersion of containerd\n\n","path":"github.com/laincloud/containerd","name":"containerd","synopsis":"","isRedistributable":true}
