docker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: GPL-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 BlkioThrottleDevice

type BlkioThrottleDevice struct {
	Path string
	Rate uint64
}

BlkioThrottleDevice defines a block I/O throttle setting.

type ContainerExitInfo

type ContainerExitInfo struct {
	ExitCode  int64
	OOMKilled bool
}

ContainerExitInfo contains information about a container's exit status.

type ContainerInfo

type ContainerInfo struct {
	ID     string
	Name   string
	Labels map[string]string
}

ContainerInfo contains information about a container for cleanup.

type ContainerSpec

type ContainerSpec struct {
	Name           string
	Image          string
	Entrypoint     []string
	Command        []string
	Env            map[string]string
	Mounts         []Mount
	NetworkName    string
	Labels         map[string]string
	ResourceLimits *ResourceLimits
}

ContainerSpec defines container configuration.

type Manager

type Manager interface {
	Start(ctx context.Context) error
	Stop() error

	// Network operations.
	EnsureNetwork(ctx context.Context, name string) error
	RemoveNetwork(ctx context.Context, name string) error

	// Container operations.
	CreateContainer(ctx context.Context, spec *ContainerSpec) (string, error)
	StartContainer(ctx context.Context, containerID string) error
	StopContainer(ctx context.Context, containerID string) error
	RemoveContainer(ctx context.Context, containerID string) error

	// Init container support.
	RunInitContainer(ctx context.Context, spec *ContainerSpec, stdout, stderr io.Writer) error

	// Log streaming.
	StreamLogs(ctx context.Context, containerID string, stdout, stderr io.Writer) error

	// Image operations.
	PullImage(ctx context.Context, imageName string, policy string) error
	GetImageDigest(ctx context.Context, imageName string) (string, error)

	// Container info.
	GetContainerIP(ctx context.Context, containerID, networkName string) (string, error)

	// Volume operations.
	CreateVolume(ctx context.Context, name string, labels map[string]string) error
	RemoveVolume(ctx context.Context, name string) error

	// Cleanup operations.
	ListContainers(ctx context.Context) ([]ContainerInfo, error)
	ListVolumes(ctx context.Context) ([]VolumeInfo, error)

	// GetClient returns the underlying Docker client for direct API access.
	GetClient() *client.Client

	// WaitForContainerExit returns channels that signal when a container exits.
	// The statusCh receives exit info (code + OOM status), errCh receives any wait errors.
	WaitForContainerExit(ctx context.Context, containerID string) (<-chan ContainerExitInfo, <-chan error)
}

Manager handles Docker operations for benchmarkoor.

func NewManager

func NewManager(log logrus.FieldLogger) (Manager, error)

NewManager creates a new Docker manager.

type Mount

type Mount struct {
	Source   string
	Target   string
	ReadOnly bool
	Type     string // "bind", "volume", "tmpfs"
	Content  []byte // For in-memory content to be written to a temp file
}

Mount defines a volume mount.

type ResourceLimits

type ResourceLimits struct {
	CpusetCpus       string // Comma-separated CPU IDs (e.g., "0,1,2")
	MemoryBytes      int64  // Memory limit in bytes
	MemorySwapBytes  int64  // Memory+swap limit (-1 = unlimited, same as MemoryBytes = no swap)
	MemorySwappiness *int64 // 0-100, controls swappiness
	// Blkio throttling.
	BlkioDeviceReadBps   []BlkioThrottleDevice
	BlkioDeviceWriteBps  []BlkioThrottleDevice
	BlkioDeviceReadIOps  []BlkioThrottleDevice
	BlkioDeviceWriteIOps []BlkioThrottleDevice
}

ResourceLimits defines container resource constraints.

type VolumeInfo

type VolumeInfo struct {
	Name   string
	Labels map[string]string
}

VolumeInfo contains information about a volume for cleanup.

Jump to

Keyboard shortcuts

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