Documentation ¶
Index ¶
- Variables
- func NewDefaultSpec(ctx context.Context, id string) (*specs.Spec, error)
- 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) DestroyContainer(ctx context.Context, id string) (*Message, error)
- func (c *Client) ListImages(ctx context.Context, filter ...string) ([]types.Image, error)
- func (c *Client) ProbeContainer(ctx context.Context, id string, timeout time.Duration) *Message
- func (c *Client) PullImage(ctx context.Context, ref string, stream *jsonstream.JSONStream) 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) SetExitHooks(hooks []func(string, *Message) error)
- func (c *Client) Version() (string, error)
- type Config
- type Container
- type Error
- type Message
- type ProgressInfo
Constants ¶
This section is empty.
Variables ¶
var ( // ErrContainerNotfound is returned when container is not found from containerd. ErrContainerNotfound = Error{containerNotfound, "Container not found"} // ErrTaskNotfound is returned when task is not found from containerd. ErrTaskNotfound = Error{taskNotfound, "Task not found"} // ErrImageNotfound is returned when image is not found from containerd. ErrImageNotfound = Error{imageNotfound, "Image not found"} // ErrTrylockFailed is returned when trylock failed. ErrTrylockFailed = Error{trylockFailed, "Trylock failed"} // ErrTimeout is returned when the connection time out. ErrTimeout = Error{timeoutFailed, "time out"} )
Functions ¶
Types ¶
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) DestroyContainer ¶
DestroyContainer kill container and delete it.
func (*Client) ListImages ¶
ListImages lists all images.
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, stream *jsonstream.JSONStream) 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 removes an image.
func (*Client) SetExitHooks ¶
SetExitHooks specified the handlers of container exit.
type Config ¶
type Config struct {
Address string
}
Config represents the config used to communicated with containerd.
type Container ¶
type Container struct { Info *types.ContainerInfo IO *containerio.IO Spec *specs.Spec }
Container wraps container's info.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error contains a code and a message. It implements the error interface.
func (Error) IsNotfound ¶
IsNotfound return true if this is exactly something not found.
func (Error) IsTrylockFailed ¶
IsTrylockFailed determines whether the error code is trylockFailed.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message is used to watch containerd.