docker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 17 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
}

func NewClient

func NewClient(logger *zap.Logger) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) CopyToContainer

func (c *Client) CopyToContainer(ctx context.Context, containerID, targetPath string, content io.Reader) error

func (*Client) CreateContainer

func (c *Client) CreateContainer(ctx context.Context, config *ContainerConfig) (string, error)

func (*Client) EnsureImage

func (c *Client) EnsureImage(ctx context.Context, imageName string) error

EnsureImage makes an image available, preferring a local copy: if the image already exists locally it skips the pull, otherwise it pulls from the registry.

func (*Client) ExecInContainer

func (c *Client) ExecInContainer(ctx context.Context, containerID string, config *ExecConfig) (string, error)

func (*Client) GetContainerLogs

func (c *Client) GetContainerLogs(ctx context.Context, containerID string, tail int) (string, error)

func (*Client) ImageExists

func (c *Client) ImageExists(ctx context.Context, imageName string) (bool, error)

ImageExists reports whether an image is already present in the local Docker image store, so callers can avoid a registry pull for local-only images (e.g. private STABLE images or freshly built ones).

func (*Client) InspectContainer

func (c *Client) InspectContainer(ctx context.Context, containerID string) (*types.ContainerJSON, error)

func (*Client) IsContainerRunning

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

func (*Client) ListContainersByLabels

func (c *Client) ListContainersByLabels(ctx context.Context, labels map[string]string) ([]types.Container, error)

func (*Client) Ping

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

func (*Client) PullImage

func (c *Client) PullImage(ctx context.Context, imageName string) error

func (*Client) RemoveContainer

func (c *Client) RemoveContainer(ctx context.Context, containerID string, force bool) error

func (*Client) RemoveContainerByName

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

RemoveContainerByName force-removes any container with the given exact name (in any state). It is a no-op when no such container exists, mirroring the legacy "remove_container_if_exists" behaviour. Returns true if one was removed.

func (*Client) StartContainer

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

func (*Client) StopContainer

func (c *Client) StopContainer(ctx context.Context, containerID string, timeout *int) error

func (*Client) WaitForContainer

func (c *Client) WaitForContainer(ctx context.Context, containerID string, condition container.WaitCondition) error

func (*Client) WaitForHealthy

func (c *Client) WaitForHealthy(ctx context.Context, containerID string, interval time.Duration, retries int) error

type ContainerConfig

type ContainerConfig struct {
	Image        string
	Name         string
	Entrypoint   []string
	Cmd          []string
	Env          []string
	PortBindings map[string]string
	Mounts       []Mount
	NetworkMode  string
	AutoRemove   bool
	Init         bool
	User         string
	Labels       map[string]string
}

type ExecConfig

type ExecConfig struct {
	Cmd          []string
	AttachStdout bool
	AttachStderr bool
	WorkingDir   string
	Env          []string
}

type Mount

type Mount struct {
	Type     string
	Source   string
	Target   string
	ReadOnly bool
}

Jump to

Keyboard shortcuts

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