client

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoContainerIP = errors.New("container has no network address")

ErrNoContainerIP is returned when a container has no network address.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client adapts the Moby split client to the older Docker SDK surface used here.

func NewClientWithOpts

func NewClientWithOpts(ops ...Opt) (*Client, error)

NewClientWithOpts constructs a compatibility client from Moby options.

func (*Client) Close

func (c *Client) Close() error

Close releases the underlying client.

func (*Client) ContainerCreate

func (c *Client) ContainerCreate(
	ctx context.Context,
	cfg *compatcontainer.Config,
	hostConfig *compatcontainer.HostConfig,
	networkingConfig *compatnetwork.NetworkingConfig,
	platform *ocispec.Platform,
	containerName string,
) (compatcontainer.CreateResponse, error)

ContainerCreate creates a container.

func (*Client) ContainerExec

func (c *Client) ContainerExec(
	ctx context.Context,
	containerID string,
	cmd []string,
) ([]byte, []byte, int, error)

ContainerExec runs cmd in a running container and returns its demultiplexed stdout, stderr and exit code.

func (*Client) ContainerExecInteractive

func (c *Client) ContainerExecInteractive(
	ctx context.Context,
	containerID string,
	cmd []string,
	cols, rows uint,
) (*InteractiveExec, error)

ContainerExecInteractive starts cmd in a container with a TTY and attached stdin.

func (*Client) ContainerIP

func (c *Client) ContainerIP(ctx context.Context, containerID string) (string, error)

ContainerIP returns the first network IP address of a running container.

func (*Client) ContainerList

func (c *Client) ContainerList(
	ctx context.Context,
	options compatcontainer.ListOptions,
) ([]compatcontainer.Summary, error)

ContainerList lists containers matching the provided filters.

func (*Client) ContainerLogs

func (c *Client) ContainerLogs(
	ctx context.Context,
	containerID string,
	options compatcontainer.LogsOptions,
) (io.ReadCloser, error)

ContainerLogs returns a stream of a container's stdout/stderr. The caller must close it. Unless the container was created with a TTY, the stream is multiplexed per moby/moby/client's ContainerLogsOptions doc and must be demultiplexed with stdcopy.StdCopy before use.

func (*Client) ContainerRemove

func (c *Client) ContainerRemove(
	ctx context.Context,
	containerID string,
	options compatcontainer.RemoveOptions,
) error

ContainerRemove removes a container.

func (*Client) ContainerStart

func (c *Client) ContainerStart(
	ctx context.Context,
	containerID string,
	options compatcontainer.StartOptions,
) error

ContainerStart starts a container.

func (*Client) ContainerStats

func (c *Client) ContainerStats(ctx context.Context, containerID string) (io.ReadCloser, error)

ContainerStats returns one JSON stats sample that includes the previous sample for CPU deltas. The caller must close it.

func (*Client) ContainerStop

func (c *Client) ContainerStop(
	ctx context.Context,
	containerID string,
	options compatcontainer.StopOptions,
) error

ContainerStop stops a container.

func (*Client) ContainerWait

func (c *Client) ContainerWait(
	ctx context.Context,
	containerID string,
	options compatcontainer.WaitOptions,
) compatcontainer.WaitResult

ContainerWait blocks until containerID satisfies options.Condition, matching github.com/moby/moby/client@v0.5.1 container_wait.go:41's (*Client).ContainerWait(ctx, containerID, ContainerWaitOptions) ContainerWaitResult, with the compat option/result types substituted in.

func (*Client) ImageBuild

func (c *Client) ImageBuild(
	ctx context.Context,
	buildContext io.Reader,
	options compatbuild.ImageBuildOptions,
) (compatbuild.ImageBuildResponse, error)

ImageBuild builds an image from a tar context.

func (*Client) ImageList

func (c *Client) ImageList(
	ctx context.Context,
	options compatimage.ListOptions,
) ([]compatimage.Summary, error)

ImageList lists local images.

func (*Client) ImagePull

func (c *Client) ImagePull(
	ctx context.Context,
	refStr string,
	options compatimage.PullOptions,
) (io.ReadCloser, error)

ImagePull pulls an image and returns a stream that must be closed by the caller.

func (*Client) ImageRemove

func (c *Client) ImageRemove(
	ctx context.Context,
	imageID string,
	options compatimage.RemoveOptions,
) ([]compatimage.DeleteResponse, error)

ImageRemove removes an image from the daemon.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) (any, error)

Ping checks daemon availability.

type InteractiveExec

type InteractiveExec struct {
	ID string
	// contains filtered or unexported fields
}

InteractiveExec is a TTY exec attached to stdin and stdout.

func (*InteractiveExec) Close

func (e *InteractiveExec) Close() error

Close detaches from the exec; the shell exits when its TTY hangs up.

func (*InteractiveExec) Read

func (e *InteractiveExec) Read(p []byte) (int, error)

Read reads terminal output.

func (*InteractiveExec) Resize

func (e *InteractiveExec) Resize(ctx context.Context, cols, rows uint) error

Resize changes the TTY size.

func (*InteractiveExec) Write

func (e *InteractiveExec) Write(p []byte) (int, error)

Write writes terminal input.

type Opt

type Opt = mobyclient.Opt

Opt aliases the Moby client option type.

func FromEnv

func FromEnv() Opt

FromEnv applies Docker-compatible client settings from the environment.

func WithAPIVersionNegotiation

func WithAPIVersionNegotiation() Opt

WithAPIVersionNegotiation enables API version negotiation.

func WithHost

func WithHost(host string) Opt

WithHost sets the daemon host.

Jump to

Keyboard shortcuts

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