Documentation
¶
Index ¶
Constants ¶
View Source
const ( DriverDocker = "docker" DriverPodman = "podman" DriverApple = "apple" )
View Source
const ( LibraryName = "scriptling.container" LibraryDesc = "Container management library supporting Docker, Podman, and Apple Containers" DefaultDockerSocket = "/var/run/docker.sock" DefaultPodmanSocket = "/var/run/podman.sock" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContainerDriver ¶
type ContainerDriver interface {
// Login authenticates with a container registry.
Login(ctx context.Context, server, username, password string) error
// Pull fetches an image from a registry.
Pull(ctx context.Context, image string) error
// Exec runs a command inside a running container and captures output.
Exec(ctx context.Context, nameOrID string, command []string, opts ExecOptions) (*ExecResult, error)
// ExecStream runs a command inside a running container, calling fn for each output line.
ExecStream(ctx context.Context, nameOrID string, command []string, opts ExecOptions, fn func(stream, line string)) (*ExecResult, error)
// ImageList returns locally available images.
ImageList(ctx context.Context) ([]ImageInfo, error)
// ImageRemove removes a local image.
ImageRemove(ctx context.Context, image string) error
// Run creates and starts a container, returning its ID.
Run(ctx context.Context, image string, opts RunOptions) (string, error)
// Stop stops a running container (graceful then force).
Stop(ctx context.Context, nameOrID string) error
// Remove removes a stopped container.
Remove(ctx context.Context, nameOrID string) error
// Inspect returns details about a container.
Inspect(ctx context.Context, nameOrID string) (*ContainerInfo, error)
// List returns all containers (running and stopped).
List(ctx context.Context) ([]ContainerInfo, error)
// VolumeCreate creates a named volume. size is optional (e.g. "20G") and
// only honoured by Apple Containers; other drivers silently ignore it.
VolumeCreate(ctx context.Context, name, size string) error
// VolumeRemove removes a named volume.
VolumeRemove(ctx context.Context, name string) error
// VolumeList returns all named volumes.
VolumeList(ctx context.Context) ([]string, error)
}
ContainerDriver is the interface every runtime driver must implement.
type ContainerInfo ¶
ContainerInfo is the common container representation returned by inspect/list.
type ExecOptions ¶
ExecOptions holds optional parameters for Exec / ExecStream.
type ExecResult ¶
ExecResult holds the output of a completed exec.
Click to show internal directories.
Click to hide internal directories.