Versions in this module Expand all Collapse all v1 v1.0.0 Dec 11, 2025 Changes in this version + const LabelManagedBy + const LabelManagedByValue + const LabelPoolName + var ErrImageRequired = errors.New("image is required") + var ErrNetworkNameRequired = errors.New("network name is required") + var ErrOutputLimitExceeded = errors.New("output limit exceeded") + var ErrPoolNameRequired = errors.New("pool name is required") + func MergeLabels(labelMaps ...map[string]string) map[string]string + func PoolLabels(poolName string) map[string]string + type Container interface + Exec func(ctx context.Context, cmd []string) (*ExecResult, error) + ExecStd func(ctx context.Context, cmd []string, opts ExecOptions) (*ExecResult, error) + ExecStream func(ctx context.Context, cmd []string, stdout, stderr io.Writer, opts ExecOptions) (exitCode int, err error) + ID func() string + Image func() string + Labels func() map[string]string + State func() ContainerState + Stop func(ctx context.Context) error + func NewContainerClient(opts ContainerOpts) Container + type ContainerClient struct + func (c *ContainerClient) Exec(ctx context.Context, cmd []string) (*ExecResult, error) + func (c *ContainerClient) ExecStd(ctx context.Context, cmd []string, opts ExecOptions) (*ExecResult, error) + func (c *ContainerClient) ExecStream(ctx context.Context, cmd []string, stdout, stderr io.Writer, opts ExecOptions) (int, error) + func (c *ContainerClient) ID() string + func (c *ContainerClient) Image() string + func (c *ContainerClient) Labels() map[string]string + func (c *ContainerClient) State() ContainerState + func (c *ContainerClient) Stop(ctx context.Context) error + type ContainerOpts struct + Docker Docker + ID string + Image string + Labels map[string]string + State ContainerState + type ContainerState string + const StateCreated + const StateDead + const StateExited + const StatePaused + const StateRemoving + const StateRestarting + const StateRunning + type CreateContainerOptions struct + Config *container.Config + HostConfig *container.HostConfig + type Docker interface + Close func() error + CreateContainer func(ctx context.Context, networkName string, opts CreateContainerOptions) (Container, error) + EnsureNetwork func(ctx context.Context, networkName string) (bool, error) + Exec func(ctx context.Context, containerID string, cmd []string) (*ExecResult, error) + ExecStd func(ctx context.Context, containerID string, cmd []string, opts ExecOptions) (*ExecResult, error) + ExecStream func(ctx context.Context, containerID string, cmd []string, ...) (exitCode int, err error) + ListContainersByLabels func(ctx context.Context, labels ...Label) ([]Container, error) + Ping func(ctx context.Context) error + PullImage func(ctx context.Context, image string) error + RemoveContainer func(ctx context.Context, containerID string) error + RemoveNetwork func(ctx context.Context, networkName string) error + SetCleanupTimeout func(timeout time.Duration) + StopContainer func(ctx context.Context, containerID string, opts client.ContainerStopOptions) error + type DockerClient struct + CleanupTimeout time.Duration + func NewDockerClient() (*DockerClient, error) + func NewDockerClientWithOpts(opts ...client.Opt) (*DockerClient, error) + func (d *DockerClient) Close() error + func (d *DockerClient) CreateContainer(ctx context.Context, networkName string, opts CreateContainerOptions) (Container, error) + func (d *DockerClient) EnsureNetwork(ctx context.Context, networkName string) (bool, error) + func (d *DockerClient) Exec(ctx context.Context, containerID string, cmd []string) (*ExecResult, error) + func (d *DockerClient) ExecStd(ctx context.Context, containerID string, cmd []string, opts ExecOptions) (*ExecResult, error) + func (d *DockerClient) ExecStream(ctx context.Context, containerID string, cmd []string, ...) (int, error) + func (d *DockerClient) ListContainersByLabels(ctx context.Context, labels ...Label) ([]Container, error) + func (d *DockerClient) Ping(ctx context.Context) error + func (d *DockerClient) PullImage(ctx context.Context, image string) error + func (d *DockerClient) RemoveContainer(ctx context.Context, containerID string) error + func (d *DockerClient) RemoveNetwork(ctx context.Context, networkName string) error + func (d *DockerClient) SetCleanupTimeout(timeout time.Duration) + func (d *DockerClient) StopContainer(ctx context.Context, containerID string, opts client.ContainerStopOptions) error + type DockerPool struct + func NewDockerPool(ctx context.Context, docker Docker, poolName string, networkName string, ...) (*DockerPool, error) + func (p *DockerPool) Acquire(ctx context.Context) (Container, error) + func (p *DockerPool) IdleCount() int + func (p *DockerPool) InUse() int64 + func (p *DockerPool) Remove(ctx context.Context, c Container) + func (p *DockerPool) Return(ctx context.Context, c Container) + func (p *DockerPool) Shutdown(ctx context.Context) error + type DockerPoolConfig struct + ContainerConfig CreateContainerOptions + Labels map[string]string + MaxConcurrentDockerOps int + MaxIdle int + MinIdle int + OnError func(error) + RefillInterval time.Duration + func DefaultDockerPoolConfig() DockerPoolConfig + type ExecOptions struct + Limit int64 + Stdin io.Reader + Timeout time.Duration + type ExecResult struct + ExitCode int + Stderr string + Stdout string + type Label struct + Key string + Value string + type Pool interface + Len func() int + Pop func() (elem T, ok bool) + Push func(elem T) + func NewPool[T any]() Pool[T]