Documentation ¶
Index ¶
- func NewDefaultSpec(ctx context.Context, id string) (*specs.Spec, error)
- func SetImageProxy(p string)
- type APIClient
- type Client
- func (c *Client) Close() error
- func (c *Client) ContainerPID(ctx context.Context, id string) (int, error)
- func (c *Client) ContainerPIDs(ctx context.Context, id string) ([]int, error)
- func (c *Client) CreateContainer(ctx context.Context, container *Container) error
- func (c *Client) CreateSnapshot(ctx context.Context, id, ref string) error
- func (c *Client) DestroyContainer(ctx context.Context, id string, timeout int64) (*Message, error)
- func (c *Client) ExecContainer(ctx context.Context, process *Process) error
- func (c *Client) GetOciImage(ctx context.Context, ref string) (v1.Image, error)
- func (c *Client) GetSnapshot(ctx context.Context, id string) (snapshots.Info, error)
- func (c *Client) ListImages(ctx context.Context, filter ...string) ([]types.ImageInfo, error)
- func (c *Client) PauseContainer(ctx context.Context, id string) error
- func (c *Client) ProbeContainer(ctx context.Context, id string, timeout time.Duration) *Message
- func (c *Client) PullImage(ctx context.Context, ref string, authConfig *types.AuthConfig, ...) (types.ImageInfo, error)
- func (c *Client) RecoverContainer(ctx context.Context, id string, io *containerio.IO) error
- func (c *Client) RemoveImage(ctx context.Context, ref string) error
- func (c *Client) RemoveSnapshot(ctx context.Context, id string) error
- func (c *Client) ResizeContainer(ctx context.Context, id string, opts types.ResizeOptions) error
- func (c *Client) SetExecExitHooks(hooks ...func(string, *Message) error)
- func (c *Client) SetExitHooks(hooks ...func(string, *Message) error)
- func (c *Client) UnpauseContainer(ctx context.Context, id string) error
- func (c *Client) UpdateResources(ctx context.Context, id string, resources types.Resources) error
- func (c *Client) Version(ctx context.Context) (containerd.Version, error)
- type Config
- type Container
- type ContainerAPIClient
- type ImageAPIClient
- type Message
- type Process
- type ProgressInfo
- type SnapshotAPIClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDefaultSpec ¶
NewDefaultSpec new a template spec with default.
Types ¶
type APIClient ¶
type APIClient interface { ContainerAPIClient ImageAPIClient SnapshotAPIClient Version(ctx context.Context) (containerd.Version, error) }
APIClient defines common methods of containerd api client
type Client ¶
type Client struct { Config // contains filtered or unexported fields }
Client is the client side the daemon holds to communicate with containerd.
func (*Client) ContainerPID ¶
ContainerPID returns the container's init process id.
func (*Client) ContainerPIDs ¶
ContainerPIDs returns the all processes's ids inside the container.
func (*Client) CreateContainer ¶
CreateContainer create container and start process.
func (*Client) CreateSnapshot ¶
CreateSnapshot creates a active snapshot with image's name and id.
func (*Client) DestroyContainer ¶
DestroyContainer kill container and delete it.
func (*Client) ExecContainer ¶
ExecContainer executes a process in container.
func (*Client) GetOciImage ¶
GetOciImage returns the OCI Image.
func (*Client) GetSnapshot ¶
GetSnapshot returns the snapshot's info by id.
func (*Client) ListImages ¶
ListImages lists all images.
func (*Client) PauseContainer ¶
PauseContainer pause container.
func (*Client) ProbeContainer ¶
ProbeContainer probe the container's status, if timeout <= 0, will block to receive message.
func (*Client) PullImage ¶
func (c *Client) PullImage(ctx context.Context, ref string, authConfig *types.AuthConfig, stream *jsonstream.JSONStream) (types.ImageInfo, error)
PullImage downloads an image from the remote repository.
func (*Client) RecoverContainer ¶
RecoverContainer reload the container from metadata and watch it, if program be restarted.
func (*Client) RemoveImage ¶
RemoveImage deletes an image.
func (*Client) RemoveSnapshot ¶
RemoveSnapshot removes the snapshot by id.
func (*Client) ResizeContainer ¶
ResizeContainer changes the size of the TTY of the init process running in the container to the given height and width.
func (*Client) SetExecExitHooks ¶
SetExecExitHooks specified the handlers of exec process exit.
func (*Client) SetExitHooks ¶
SetExitHooks specified the handlers of container exit.
func (*Client) UnpauseContainer ¶
UnpauseContainer unpauses a container.
func (*Client) UpdateResources ¶
UpdateResources updates the configurations of a container.
type Config ¶
type Config struct {
Address string
}
Config represents the config used to communicated with containerd.
type ContainerAPIClient ¶
type ContainerAPIClient interface { // CreateContainer creates a containerd container and start process. CreateContainer(ctx context.Context, container *Container) error // DestroyContainer kill container and delete it. DestroyContainer(ctx context.Context, id string, timeout int64) (*Message, error) // ProbeContainer probe the container's status, if timeout <= 0, will block to receive message. ProbeContainer(ctx context.Context, id string, timeout time.Duration) *Message // ContainerPIDs returns the all processes's ids inside the container. ContainerPIDs(ctx context.Context, id string) ([]int, error) // ContainerPID returns the container's init process id. ContainerPID(ctx context.Context, id string) (int, error) // ExecContainer executes a process in container. ExecContainer(ctx context.Context, process *Process) error // RecoverContainer reload the container from metadata and watch it, if program be restarted. RecoverContainer(ctx context.Context, id string, io *containerio.IO) error // PauseContainer pause container. PauseContainer(ctx context.Context, id string) error // UnpauseContainer unpauses a container. UnpauseContainer(ctx context.Context, id string) error // ResizeContainer changes the size of the TTY of the init process running // in the container to the given height and width. ResizeContainer(ctx context.Context, id string, opts types.ResizeOptions) error // UpdateResources updates the configurations of a container. UpdateResources(ctx context.Context, id string, resources types.Resources) error // SetExitHooks specified the handlers of container exit. SetExitHooks(hooks ...func(string, *Message) error) // SetExecExitHooks specified the handlers of exec process exit. SetExecExitHooks(hooks ...func(string, *Message) error) }
ContainerAPIClient provides access to containerd container features.
type ImageAPIClient ¶
type ImageAPIClient interface { // GetOciImage returns the OCI Image. GetOciImage(ctx context.Context, ref string) (v1.Image, error) // RemoveImage deletes an image. RemoveImage(ctx context.Context, ref string) error // ListImages lists all images. ListImages(ctx context.Context, filter ...string) ([]types.ImageInfo, error) // PullImage downloads an image from the remote repository. PullImage(ctx context.Context, ref string, authConfig *types.AuthConfig, stream *jsonstream.JSONStream) (types.ImageInfo, error) }
ImageAPIClient provides access to containerd image features.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message is used to watch containerd.
type ProgressInfo ¶
type ProgressInfo struct { Ref string Status string Offset int64 Total int64 StartedAt time.Time UpdatedAt time.Time // For Error handling Code int // http response code ErrorMessage string // detail error information }
ProgressInfo represents the status of downloading image.
type SnapshotAPIClient ¶
type SnapshotAPIClient interface { // CreateSnapshot creates a active snapshot with image's name and id. CreateSnapshot(ctx context.Context, id, ref string) error // GetSnapshot returns the snapshot's info by id. GetSnapshot(ctx context.Context, id string) (snapshots.Info, error) // RemoveSnapshot removes the snapshot by id. RemoveSnapshot(ctx context.Context, id string) error }
SnapshotAPIClient provides access to containerd snapshot features