docker

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

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 NewClient

func NewClient() (*Client, error)

NewClient creates a new Docker client configured from environment variables.

func (*Client) Close

func (c *Client) Close() error

Close releases the underlying Docker client connection.

func (*Client) ContainerInspect added in v0.0.5

func (c *Client) ContainerInspect(ctx context.Context, name string) (ContainerStatus, error)

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

func (c *Client) ContainerLogs(ctx context.Context, name string, w io.Writer, follow bool) error

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

func (c *Client) ContainerStop(ctx context.Context, name string, remove bool) error

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) HasImage

func (c *Client) HasImage(ctx context.Context, imageRef string) bool

HasImage checks whether the Docker daemon already has the given image.

func (*Client) LoadImageFromTar

func (c *Client) LoadImageFromTar(_ context.Context, tarPath string) (string, error)

LoadImageFromTar loads an OCI image from a tar archive into the local Docker daemon.

func (*Client) PullImage

func (c *Client) PullImage(_ context.Context, imageRef string) (string, error)

PullImage pulls an image from a remote registry 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL