package containerd
import "github.com/containerd/containerd"
Index ¶
- Constants
- func DialAddress(address string) string
- func Dialer(address string, timeout time.Duration) (net.Conn, error)
- func GenerateSpec(ctx context.Context, client *Client, c *containers.Container, opts ...SpecOpts) (*specs.Spec, error)
- func NewRemoteContainerStore(client containersapi.ContainersClient) containers.Store
- func WithExit(r *CheckpointTaskInfo) error
- func WithHostHostsFile(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error
- func WithHostLocaltime(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error
- func WithHostResolvconf(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error
- func WithKillAll(ctx context.Context, p Process, i *KillInfo) error
- func WithNoNewPrivileges(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error
- func WithProcessKill(ctx context.Context, p Process) error
- func WithPullUnpack(client *Client, c *RemoteContext) error
- func WithSchema1Conversion(client *Client, c *RemoteContext) error
- func WithSnapshotCleanup(ctx context.Context, client *Client, c containers.Container) error
- func WithStdinCloser(r *IOCloseInfo)
- func WithTTY(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error
- type CheckpointTaskInfo
- type CheckpointTaskOpts
- type Client
- func New(address string, opts ...ClientOpt) (*Client, error)
- func NewWithConn(conn *grpc.ClientConn, opts ...ClientOpt) (*Client, error)
- func (c *Client) Close() error
- func (c *Client) ContainerService() containers.Store
- func (c *Client) Containers(ctx context.Context, filters ...string) ([]Container, error)
- func (c *Client) ContentStore() content.Store
- func (c *Client) DiffService() diff.DiffService
- func (c *Client) EventService() eventsapi.EventsClient
- func (c *Client) Export(ctx context.Context, desc ocispec.Descriptor, opts ...ExportOpt) (io.ReadCloser, error)
- func (c *Client) GetImage(ctx context.Context, ref string) (Image, error)
- func (c *Client) HealthService() grpc_health_v1.HealthClient
- func (c *Client) ImageService() images.Store
- func (c *Client) Import(ctx context.Context, ref string, reader io.Reader, opts ...ImportOpt) (Image, error)
- func (c *Client) IsServing(ctx context.Context) (bool, error)
- func (c *Client) ListImages(ctx context.Context) ([]Image, error)
- func (c *Client) LoadContainer(ctx context.Context, id string) (Container, error)
- func (c *Client) NamespaceService() namespacesapi.NamespacesClient
- func (c *Client) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error)
- func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpts) (Image, error)
- func (c *Client) Push(ctx context.Context, ref string, desc ocispec.Descriptor, opts ...RemoteOpts) error
- func (c *Client) SnapshotService(snapshotterName string) snapshot.Snapshotter
- func (c *Client) Subscribe(ctx context.Context, filters ...string) (ch <-chan *eventsapi.Envelope, errs <-chan error)
- func (c *Client) TaskService() tasks.TasksClient
- func (c *Client) Version(ctx context.Context) (Version, error)
- func (c *Client) VersionService() versionservice.VersionClient
- type ClientOpt
- type Container
- type DeleteOpts
- type DirectIO
- func NewDirectIO(ctx context.Context, terminal bool) (*DirectIO, error)
- func (f *DirectIO) Cancel()
- func (f *DirectIO) Close() error
- func (f *DirectIO) Config() IOConfig
- func (f *DirectIO) Delete() error
- func (f *DirectIO) IOAttach(set *FIFOSet) (IO, error)
- func (f *DirectIO) IOCreate(id string) (IO, error)
- func (f *DirectIO) Wait()
- type ExitStatus
- func (s ExitStatus) Error() error
- func (s ExitStatus) ExitCode() uint32
- func (s ExitStatus) ExitTime() time.Time
- func (s ExitStatus) Result() (uint32, time.Time, error)
- type ExportOpt
- type FIFOSet
- type IO
- func NullIO(id string) (IO, error)
- func Stdio(id string) (IO, error)
- func StdioTerminal(id string) (IO, error)
- type IOAttach
- type IOCloseInfo
- type IOCloserOpts
- type IOConfig
- type IOCreation
- func NewIO(stdin io.Reader, stdout, stderr io.Writer) IOCreation
- func NewIOWithTerminal(stdin io.Reader, stdout, stderr io.Writer, terminal bool) IOCreation
- type Image
- type ImportOpt
- type KillInfo
- type KillOpts
- type NewContainerOpts
- func WithCheckpoint(desc v1.Descriptor, snapshotKey string) NewContainerOpts
- func WithContainerExtension(name string, extension interface{}) NewContainerOpts
- func WithContainerLabels(labels map[string]string) NewContainerOpts
- func WithImage(i Image) NewContainerOpts
- func WithNewSnapshot(id string, i Image) NewContainerOpts
- func WithNewSnapshotView(id string, i Image) NewContainerOpts
- func WithNewSpec(opts ...SpecOpts) NewContainerOpts
- func WithRemappedSnapshot(id string, i Image, uid, gid uint32) NewContainerOpts
- func WithRemappedSnapshotView(id string, i Image, uid, gid uint32) NewContainerOpts
- func WithRuntime(name string, options interface{}) NewContainerOpts
- func WithSnapshot(id string) NewContainerOpts
- func WithSnapshotter(name string) NewContainerOpts
- func WithSpec(s *specs.Spec, opts ...SpecOpts) NewContainerOpts
- type NewTaskOpts
- func WithRootFS(mounts []mount.Mount) NewTaskOpts
- func WithTaskCheckpoint(desc v1.Descriptor) NewTaskOpts
- type Process
- type ProcessDeleteOpts
- type ProcessStatus
- type RemoteContext
- type RemoteOpts
- func WithImageHandler(h images.Handler) RemoteOpts
- func WithPullSnapshotter(snapshotterName string) RemoteOpts
- func WithResolver(resolver remotes.Resolver) RemoteOpts
- type SpecOpts
- func WithCgroup(path string) SpecOpts
- func WithHostNamespace(ns specs.LinuxNamespaceType) SpecOpts
- func WithHostname(name string) SpecOpts
- func WithImageConfig(i Image) SpecOpts
- func WithLinuxNamespace(ns specs.LinuxNamespace) SpecOpts
- func WithNamespacedCgroup() SpecOpts
- func WithProcessArgs(args ...string) SpecOpts
- func WithRootFSPath(path string, readonly bool) SpecOpts
- func WithUidGid(uid, gid uint32) SpecOpts
- func WithUserID(uid uint32) SpecOpts
- func WithUserNamespace(container, host, size uint32) SpecOpts
- func WithUsername(username string) SpecOpts
- type Status
- type Task
- type TaskInfo
- type UpdateTaskInfo
- type UpdateTaskOpts
- 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 = "naive" )
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.
Functions ¶
func DialAddress ¶
func Dialer ¶
func GenerateSpec ¶
func GenerateSpec(ctx context.Context, client *Client, c *containers.Container, opts ...SpecOpts) (*specs.Spec, error)
GenerateSpec will generate a default spec from the provided image for use as a containerd container
func NewRemoteContainerStore ¶
func NewRemoteContainerStore(client containersapi.ContainersClient) containers.Store
func WithExit ¶
func WithExit(r *CheckpointTaskInfo) error
WithExit causes the task to exit after a successful checkpoint
func WithHostHostsFile ¶
WithHostHostsFile bind-mounts the host's /etc/hosts into the container as readonly
func WithHostLocaltime ¶
WithHostLocaltime bind-mounts the host's /etc/localtime into the container as readonly
func WithHostResolvconf ¶
WithHostResolvconf bind-mounts the host's /etc/resolv.conf into the container as readonly
func WithKillAll ¶
WithKillAll kills all processes for a task
func WithNoNewPrivileges ¶
func WithNoNewPrivileges(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error
WithNoNewPrivileges sets no_new_privileges on the process for the container
func WithProcessKill ¶
WithProcessKill will forcefully kill and delete a process
func WithPullUnpack ¶
func WithPullUnpack(client *Client, c *RemoteContext) error
WithPullUnpack is used to unpack an image after pull. This uses the snapshotter, content store, and diff service configured for the client.
func WithSchema1Conversion ¶
func WithSchema1Conversion(client *Client, c *RemoteContext) error
WithSchema1Conversion is used to convert Docker registry schema 1 manifests to oci manifests on pull. Without this option schema 1 manifests will return a not supported error.
func WithSnapshotCleanup ¶
WithSnapshotCleanup deletes the rootfs snapshot allocated for the container
func WithStdinCloser ¶
func WithStdinCloser(r *IOCloseInfo)
WithStdinCloser closes the stdin of a process
func WithTTY ¶
WithTTY sets the information on the spec as well as the environment variables for using a TTY
Types ¶
type CheckpointTaskInfo ¶
type CheckpointTaskInfo struct { // ParentCheckpoint is the digest of a parent checkpoint ParentCheckpoint digest.Digest // Options hold runtime specific settings for checkpointing a task Options interface{} }
CheckpointTaskInfo allows specific checkpoint information to be set for the task
type CheckpointTaskOpts ¶
type CheckpointTaskOpts func(*CheckpointTaskInfo) error
CheckpointTaskOpts allows the caller to set checkpoint options
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the client to interact with containerd and its various services using a uniform interface
func New ¶
New returns a new containerd client that is connected to the containerd instance provided by address
func NewWithConn ¶
func NewWithConn(conn *grpc.ClientConn, opts ...ClientOpt) (*Client, error)
NewWithConn returns a new containerd client that is connected to the containerd instance provided by the connection
func (*Client) Close ¶
Close closes the clients connection to containerd
func (*Client) ContainerService ¶
func (c *Client) ContainerService() containers.Store
func (*Client) Containers ¶
Containers returns all containers created in containerd
func (*Client) ContentStore ¶
func (*Client) DiffService ¶
func (c *Client) DiffService() diff.DiffService
func (*Client) EventService ¶
func (c *Client) EventService() eventsapi.EventsClient
func (*Client) Export ¶
func (c *Client) Export(ctx context.Context, desc ocispec.Descriptor, opts ...ExportOpt) (io.ReadCloser, error)
Export exports an image to a Tar stream. OCI format is used by default. It is up to caller to put "org.opencontainers.image.ref.name" annotation to desc.
func (*Client) GetImage ¶
GetImage returns an existing image
func (*Client) HealthService ¶
func (c *Client) HealthService() grpc_health_v1.HealthClient
func (*Client) ImageService ¶
func (*Client) Import ¶
func (c *Client) Import(ctx context.Context, ref string, reader io.Reader, opts ...ImportOpt) (Image, error)
Import imports an image from a Tar stream using reader. OCI format is assumed by default.
Note that unreferenced blobs are imported to the content store as well.
func (*Client) IsServing ¶
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) ListImages ¶
ListImages returns all existing images
func (*Client) LoadContainer ¶
LoadContainer loads an existing container from metadata
func (*Client) NamespaceService ¶
func (c *Client) NamespaceService() namespacesapi.NamespacesClient
func (*Client) NewContainer ¶
func (c *Client) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error)
NewContainer will create a new container in container with the provided id the id must be unique within the namespace
func (*Client) Pull ¶
Pull downloads the provided content into containerd's content store
func (*Client) Push ¶
func (c *Client) Push(ctx context.Context, ref string, desc ocispec.Descriptor, opts ...RemoteOpts) error
Push uploads the provided content to a remote resource
func (*Client) SnapshotService ¶
func (c *Client) SnapshotService(snapshotterName string) snapshot.Snapshotter
func (*Client) Subscribe ¶
func (c *Client) Subscribe(ctx context.Context, filters ...string) (ch <-chan *eventsapi.Envelope, errs <-chan error)
Subscribe to events that match one or more of the provided filters.
Callers should listen on both the envelope channel and errs channel. If the errs channel returns nil or an error, the subscriber should terminate.
To cancel shutdown reciept of events, cancel the provided context. The errs channel will be closed and return a nil error.
func (*Client) TaskService ¶
func (c *Client) TaskService() tasks.TasksClient
func (*Client) Version ¶
Version returns the version of containerd that the client is connected to
func (*Client) VersionService ¶
func (c *Client) VersionService() versionservice.VersionClient
type ClientOpt ¶
type ClientOpt func(c *clientOpts) error
ClientOpt allows callers to set options on the containerd client
func WithDefaultNamespace ¶
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 WithDialOpts ¶
func WithDialOpts(opts []grpc.DialOption) ClientOpt
WithDialOpts allows grpc.DialOptions to be set on the connection
type Container ¶
type Container interface { // ID identifies the container ID() string // Info returns the underlying container record type Info() containers.Container // Delete removes the container Delete(context.Context, ...DeleteOpts) error // NewTask creates a new task based on the container metadata NewTask(context.Context, IOCreation, ...NewTaskOpts) (Task, error) // Spec returns the OCI runtime specification Spec() (*specs.Spec, error) // Task returns the current task for the container // // If IOAttach 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 Task(context.Context, IOAttach) (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() map[string]prototypes.Any }
Container is a metadata object for container resources and task creation
type DeleteOpts ¶
DeleteOpts allows the caller to set options for the deletion of a container
type DirectIO ¶
type DirectIO struct { Stdin io.WriteCloser Stdout io.ReadCloser Stderr io.ReadCloser // contains filtered or unexported fields }
func NewDirectIO ¶
NewDirectIO returns an IO implementation that exposes the pipes directly
func (*DirectIO) Cancel ¶
func (f *DirectIO) Cancel()
func (*DirectIO) Close ¶
func (*DirectIO) Config ¶
func (*DirectIO) Delete ¶
func (*DirectIO) IOAttach ¶
func (*DirectIO) IOCreate ¶
func (*DirectIO) Wait ¶
func (f *DirectIO) Wait()
type ExitStatus ¶
type ExitStatus struct {
// contains filtered or unexported fields
}
ExitStatus encapsulates a process' exit status. It is used by `Wait()` to return either a process exit code or an error
func (ExitStatus) Error ¶
func (s ExitStatus) Error() error
Error returns the error, if any, that occured while waiting for the process.
func (ExitStatus) ExitCode ¶
func (s ExitStatus) ExitCode() uint32
ExitCode returns the exit code of the process. This is only valid is Error() returns nil
func (ExitStatus) ExitTime ¶
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 ¶
func (s ExitStatus) Result() (uint32, time.Time, error)
Result returns the exit code and time of the exit status. An error may be returned here to which indicates there was an error
at some point while waiting for the exit status. It does not signify an error with the process itself.
If an error is returned, the process may still be running.
type ExportOpt ¶
type ExportOpt func(c *exportOpts) error
ExportOpt allows callers to set export options
func WithOCIExportFormat ¶
func WithOCIExportFormat() ExportOpt
WithOCIExportFormat sets the OCI image format as the export target
type FIFOSet ¶
type FIFOSet struct { // Dir is the directory holding the task fifos Dir string // In, Out, and Err fifo paths In, Out, Err string // Terminal returns true if a terminal is being used for the task Terminal bool }
FIFOSet is a set of fifos for use with tasks
func NewFifos ¶
NewFifos returns a new set of fifos for the task
type IO ¶
type IO interface { // Config returns the IO configuration. Config() IOConfig // Cancel aborts all current io operations Cancel() // Wait blocks until all io copy operations have completed Wait() // Close cleans up all open io resources Close() error }
IO holds the io information for a task or process
func NullIO ¶
NullIO redirects the container's IO into /dev/null
func Stdio ¶
Stdio returns an IO set to be used for a task that outputs the container's IO as the current processes Stdio
func StdioTerminal ¶
StdioTerminal will setup the IO for the task to use a terminal
type IOAttach ¶
IOAttach allows callers to reattach to running tasks
func WithAttach ¶
WithAttach attaches the existing io for a task to the provided io.Reader/Writers
type IOCloseInfo ¶
type IOCloseInfo struct { Stdin bool }
IOCloseInfo allows specific io pipes to be closed on a process
type IOCloserOpts ¶
type IOCloserOpts func(*IOCloseInfo)
IOCloserOpts allows the caller to set specific pipes as closed on a process
type IOConfig ¶
type IOConfig struct { // Terminal is true if one has been allocated Terminal bool // Stdin path Stdin string // Stdout path Stdout string // Stderr path Stderr string }
IOConfig holds the io configurations.
type IOCreation ¶
IOCreation creates new IO sets for a task
func NewIO ¶
func NewIO(stdin io.Reader, stdout, stderr io.Writer) IOCreation
NewIO returns an IOCreation that will provide IO sets without a terminal
func NewIOWithTerminal ¶
NewIOWithTerminal creates a new io set with the provied io.Reader/Writers for use with a terminal
type Image ¶
type Image interface { // Name of the image Name() string // Target descriptor for the image content Target() ocispec.Descriptor // Unpack unpacks the image's content into a snapshot Unpack(context.Context, string) error // RootFS returns the unpacked diffids that make up images rootfs. RootFS(ctx context.Context) ([]digest.Digest, error) // Size returns the total size of the image's packed resources. Size(ctx context.Context) (int64, error) // Config descriptor for the image. Config(ctx context.Context) (ocispec.Descriptor, error) }
Image describes an image used by containers
type ImportOpt ¶
type ImportOpt func(c *importOpts) error
ImportOpt allows the caller to specify import specific options
func WithOCIImportFormat ¶
func WithOCIImportFormat() ImportOpt
WithOCIImportFormat sets the import format for an OCI image format
func WithRefObject ¶
WithRefObject specifies the ref object to import. If refObject is empty, it is copied from the ref argument of Import().
type KillInfo ¶
type KillInfo struct { // All kills all processes inside the task // only valid on tasks, ignored on processes All bool }
type KillOpts ¶
type NewContainerOpts ¶
NewContainerOpts allows the caller to set additional options when creating a container
func WithCheckpoint ¶
func WithCheckpoint(desc v1.Descriptor, snapshotKey string) NewContainerOpts
WithCheckpoint 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
func WithContainerExtension ¶
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` otherwise the type data will be inferred, including how to encode and decode the object.
func WithContainerLabels ¶
func WithContainerLabels(labels map[string]string) NewContainerOpts
WithContainerLabels adds the provided labels to the container
func WithImage ¶
func WithImage(i Image) NewContainerOpts
WithImage sets the provided image as the base for the container
func WithNewSnapshot ¶
func WithNewSnapshot(id string, i Image) NewContainerOpts
WithNewSnapshot allocates a new snapshot to be used by the container as the root filesystem in read-write mode
func WithNewSnapshotView ¶
func WithNewSnapshotView(id string, i Image) NewContainerOpts
WithNewSnapshotView allocates a new snapshot to be used by the container as the root filesystem in read-only mode
func WithNewSpec ¶
func WithNewSpec(opts ...SpecOpts) NewContainerOpts
WithNewSpec generates a new spec for a new container
func WithRemappedSnapshot ¶
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 ¶
func WithRemappedSnapshotView(id string, i Image, uid, gid uint32) NewContainerOpts
WithRemappedSnapshotView is similar to WithRemappedSnapshot but rootfs is mounted as read-only.
func WithRuntime ¶
func WithRuntime(name string, options interface{}) NewContainerOpts
WithRuntime allows a user to specify the runtime name and additional options that should be used to create tasks for the container
func WithSnapshot ¶
func WithSnapshot(id string) NewContainerOpts
WithSnapshot uses an existing root filesystem for the container
func WithSnapshotter ¶
func WithSnapshotter(name string) NewContainerOpts
WithSnapshotter sets the provided snapshotter for use by the container
This option must appear before other snapshotter options to have an effect.
func WithSpec ¶
func WithSpec(s *specs.Spec, opts ...SpecOpts) NewContainerOpts
WithSpec sets the provided spec on the container
type NewTaskOpts ¶
NewTaskOpts allows the caller to set options on a new task
func WithRootFS ¶
func WithRootFS(mounts []mount.Mount) NewTaskOpts
WithRootFS allows a task to be created without a snapshot being allocated to its container
func WithTaskCheckpoint ¶
func WithTaskCheckpoint(desc v1.Descriptor) NewTaskOpts
WithTaskCheckpoint allows a task to be created with live runtime and memory data from a previous checkpoint. Additional software such as CRIU may be required to restore a task from a checkpoint
type Process ¶
type Process interface { // Pid is the system specific process id Pid() uint32 // Start starts the process executing the user's defined binary Start(context.Context) error // Delete removes the process and any resources allocated returning the exit status Delete(context.Context, ...ProcessDeleteOpts) (*ExitStatus, error) // Kill sends the provided signal to the process Kill(context.Context, syscall.Signal, ...KillOpts) error // Wait asynchronously waits for the process to exit, and sends the exit code to the returned channel Wait(context.Context) (<-chan ExitStatus, error) // CloseIO allows various pipes to be closed on the process CloseIO(context.Context, ...IOCloserOpts) error // Resize changes the width and heigh of the process's terminal Resize(ctx context.Context, w, h uint32) error // IO returns the io set for the process IO() IO // Status returns the executing status of the process Status(context.Context) (Status, error) }
Process represents a system process
type ProcessDeleteOpts ¶
ProcessDeleteOpts allows the caller to set options for the deletion of a task
type ProcessStatus ¶
type ProcessStatus string
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 ¶
type RemoteContext struct { // Resolver is used to resolve names to objects, fetchers, and pushers. // If no resolver is provided, defaults to Docker registry resolver. Resolver remotes.Resolver // Unpack is done after an image is pulled to extract into a snapshotter. // If an image is not unpacked on pull, it can be unpacked any time // afterwards. Unpacking is required to run an image. Unpack bool // Snapshotter used for unpacking Snapshotter string // BaseHandlers are a set of handlers which get are called on dispatch. // These handlers always get called before any operation specific // handlers. BaseHandlers []images.Handler // ConvertSchema1 is whether to convert Docker registry schema 1 // manifests. If this option is false then any image which resolves // to schema 1 will return an error since schema 1 is not supported. ConvertSchema1 bool }
RemoteContext is used to configure object resolutions and transfers with remote content stores and image providers.
type RemoteOpts ¶
type RemoteOpts func(*Client, *RemoteContext) error
RemoteOpts allows the caller to set distribution options for a remote
func WithImageHandler ¶
func WithImageHandler(h images.Handler) RemoteOpts
WithImageHandler adds a base handler to be called on dispatch.
func WithPullSnapshotter ¶
func WithPullSnapshotter(snapshotterName string) RemoteOpts
WithPullSnapshotter specifies snapshotter name used for unpacking
func WithResolver ¶
func WithResolver(resolver remotes.Resolver) RemoteOpts
WithResolver specifies the resolver to use.
type SpecOpts ¶
SpecOpts sets spec specific information to a newly generated OCI spec
func WithCgroup ¶
WithCgroup sets the container's cgroup path
func WithHostNamespace ¶
func WithHostNamespace(ns specs.LinuxNamespaceType) SpecOpts
WithHostNamespace allows a task to run inside the host's linux namespace
func WithHostname ¶
WithHostname sets the container's hostname
func WithImageConfig ¶
WithImageConfig configures the spec to from the configuration of an Image
func WithLinuxNamespace ¶
func WithLinuxNamespace(ns specs.LinuxNamespace) SpecOpts
WithLinuxNamespace uses the passed in namespace for the spec. If a namespace of the same type already exists in the spec, the existing namespace is replaced by the one provided.
func WithNamespacedCgroup ¶
func WithNamespacedCgroup() SpecOpts
WithNamespacedCgroup uses the namespace set on the context to create a root directory for containers in the cgroup with the id as the subcgroup
func WithProcessArgs ¶
WithProcessArgs replaces the args on the generated spec
func WithRootFSPath ¶
WithRootFSPath specifies unmanaged rootfs path.
func WithUidGid ¶
WithUidGid allows the UID and GID for the Process to be set
func WithUserID ¶
WithUserID sets the correct UID and GID for the container based on the image's /etc/passwd contents. If /etc/passwd does not exist, or uid is not found in /etc/passwd, it sets gid to be the same with uid, and not returns error.
func WithUserNamespace ¶
WithUserNamespace sets the uid and gid mappings for the task this can be called multiple times to add more mappings to the generated spec
func WithUsername ¶
WithUsername sets the correct UID and GID for the container based on the the image's /etc/passwd contents. If /etc/passwd does not exist, or the username is not found in /etc/passwd, it returns error.
type Status ¶
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 ¶
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, IOCreation) (Process, error) // Pids returns a list of system specific process ids inside the task Pids(context.Context) ([]uint32, error) // Checkpoint serializes the runtime and memory information of a task into an // OCI Index that can be push and pulled from a remote resource. // // Additional software like CRIU maybe required to checkpoint and restore tasks Checkpoint(context.Context, ...CheckpointTaskOpts) (v1.Descriptor, 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, IOAttach) (Process, error) // Metrics returns task metrics for runtime specific metrics // // The metric types are generic to containerd and change depending on the runtime // For the built in Linux runtime, github.com/containerd/cgroups.Metrics // are returned in protobuf format Metrics(context.Context) (*types.Metric, error) }
Task is the executable object within containerd
type TaskInfo ¶
type TaskInfo struct { // Checkpoint is the Descriptor for an existing checkpoint that can be used // to restore a task's runtime and memory state Checkpoint *types.Descriptor // RootFS is a list of mounts to use as the task's root filesystem RootFS []mount.Mount // Options hold runtime specific settings for task creation Options interface{} }
TaskInfo sets options for task creation
type UpdateTaskInfo ¶
type UpdateTaskInfo struct { // Resources updates a tasks resource constraints Resources interface{} }
UpdateTaskInfo allows updated specific settings to be changed on a task
type UpdateTaskOpts ¶
type UpdateTaskOpts func(context.Context, *Client, *UpdateTaskInfo) error
UpdateTaskOpts allows a caller to update task settings
func WithResources ¶
func WithResources(resources *specs.LinuxResources) UpdateTaskOpts
WithResources sets the provided resources on the spec for task updates
type Version ¶
type Version struct { // Version number Version string // Revision from git that was built Revision string }
Version of containerd
Source Files ¶
client.go client_opts.go container.go container_opts.go container_opts_unix.go containerstore.go dialer.go dialer_unix.go export.go grpc.go image.go import.go io.go io_unix.go process.go snapshotter_default_unix.go spec.go spec_opts.go spec_opts_unix.go spec_unix.go task.go task_opts.go
Directories ¶
Path | Synopsis |
---|---|
api | |
api/services | |
api/services/containers | |
api/services/containers/v1 | Package containers is a generated protocol buffer package. |
api/services/content | |
api/services/content/v1 | Package content is a generated protocol buffer package. |
api/services/diff | |
api/services/diff/v1 | Package diff is a generated protocol buffer package. |
api/services/events | |
api/services/events/v1 | Package events is a generated protocol buffer package. |
api/services/images | |
api/services/images/v1 | Package images is a generated protocol buffer package. |
api/services/namespaces | |
api/services/namespaces/v1 | Package namespaces is a generated protocol buffer package. |
api/services/snapshot | |
api/services/snapshot/v1 | Package snapshot is a generated protocol buffer package. |
api/services/tasks | |
api/services/tasks/v1 | Package tasks is a generated protocol buffer package. |
api/services/version | |
api/services/version/v1 | Package version is a generated protocol buffer package. |
api/types | Package types is a generated protocol buffer package. |
api/types/task | Package task is a generated protocol buffer package. |
archive | |
archive/compression | |
cmd | |
cmd/containerd | |
cmd/containerd-shim | |
cmd/containerd-stress | |
cmd/ctr | |
cmd/protoc-gen-gogoctrd | |
containers | |
content | |
content/local | |
content/testsuite | |
differ | |
errdefs | Package errdefs defines the common errors used throughout containerd packages. |
events | |
filters | Package filters defines a syntax and parser that can be used for the filtration of items across the containerd API. |
fs | |
fs/fstest | |
gc | Package gc experiments with providing central gc tooling to ensure deterministic resource removal within containerd. |
identifiers | Package identifiers provides common validation for identifiers and keys across containerd. |
images | |
labels | |
linux | |
linux/runcopts | Package runcopts is a generated protocol buffer package. |
linux/shim | |
linux/shim/v1 | Package shim is a generated protocol buffer package. |
log | |
metadata | |
metadata/boltutil | |
mount | |
mount/lookup_test | |
namespaces | Package namespaces provides tools for working with namespaces across containerd. |
platforms | Package platforms provides a toolkit for normalizing, matching and specifying container platforms. |
plugin | |
progress | Package progress assists in displaying human readable progress information. |
protobuf | |
protobuf/plugin | Package plugin is a generated protocol buffer package. |
protobuf/plugin/fieldpath | |
reaper | |
reference | |
remotes | |
remotes/docker | |
remotes/docker/schema1 | |
rootfs | |
runtime | |
server | |
services | |
services/containers | |
services/content | |
services/diff | |
services/events | |
services/healthcheck | |
services/images | |
services/namespaces | |
services/snapshot | |
services/tasks | |
services/version | |
snapshot | |
snapshot/naive | |
snapshot/storage | Package storage provides a metadata storage implementation for snapshot drivers. |
snapshot/testsuite | |
sys | |
testutil | |
version | |
windows | |
windows/hcsshimopts | hcsshimopts holds the windows runtime specific options |
- Version
- v1.0.0-beta.1
- Published
- Sep 22, 2017
- Platform
- darwin/amd64
- Imports
- 64 packages
- Last checked
- 9 minutes ago –
Tools for package owners.