Documentation
¶
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) ContainerInspect(ctx context.Context, name string) (ContainerStatus, error)
- func (c *Client) ContainerLogs(ctx context.Context, name string, w io.Writer, follow bool) error
- func (c *Client) ContainerRun(ctx context.Context, name, imageRef string, hostPort, containerPort int, ...) error
- func (c *Client) ContainerStop(ctx context.Context, name string, remove bool) error
- func (c *Client) HasImage(ctx context.Context, imageRef string) bool
- func (c *Client) LoadImageFromTar(_ context.Context, tarPath string) (string, error)
- func (c *Client) PullImage(_ context.Context, imageRef string) (string, error)
- type ContainerStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Docker client library for image operations.
func (*Client) ContainerInspect ¶ added in v0.0.5
ContainerInspect returns the status of the named container. When the container does not exist, State is "not found" and no error is returned.
func (*Client) ContainerLogs ¶ added in v0.0.5
ContainerLogs streams stdout and stderr of the named container to w. When follow is true the stream stays open until ctx is cancelled or the container exits.
func (*Client) ContainerRun ¶ added in v0.0.5
func (c *Client) ContainerRun(ctx context.Context, name, imageRef string, hostPort, containerPort int, cmd []string) error
ContainerRun pulls the image if absent, creates a privileged container binding hostPort on the host to containerPort inside the container, then starts it. cmd overrides the container's default command (nil uses the image default). Returns an error if the container already exists and is running.
func (*Client) ContainerStop ¶ added in v0.0.5
ContainerStop stops the named container. It is a no-op if the container is already stopped or does not exist. When remove is true the container is also removed.
func (*Client) LoadImageFromTar ¶
LoadImageFromTar loads an OCI image from a tar archive into the local Docker daemon.
type ContainerStatus ¶ added in v0.0.5
type ContainerStatus struct {
State string // e.g. "running", "exited", "not found"
Image string
HostPort int // 0 when not bound or not found
}
ContainerStatus holds the inspected state of a named container.