container

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package container provides an abstraction layer for container runtimes, allowing YAP to operate with podman, docker, or a built-in rootless runner.

Index

Constants

View Source
const (
	// RuntimeCLI uses the system podman or docker CLI.
	RuntimeCLI = runtimetype.CLI
	// RuntimeRootless uses the built-in rootless runner (go-containerregistry + rootlesskit).
	RuntimeRootless = runtimetype.Rootless
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Runtime

type Runtime interface {
	// Pull downloads the container image for the given distribution tag.
	Pull(distro string) error

	// Run executes the given command inside the distro container, mounting
	// workDir as /workspace inside the container.
	// args are passed directly to the container ENTRYPOINT.
	Run(distro, workDir string, args []string) error

	// RunShell executes a shell command string inside the distro container,
	// overriding the ENTRYPOINT with /bin/sh -c. Use this to chain multiple
	// yap sub-commands in a single container invocation.
	RunShell(distro, workDir, shellCmd string) error

	// Type returns the runtime identifier.
	Type() RuntimeType
}

Runtime is the interface every container backend must satisfy.

func Detect

func Detect(override string) (Runtime, error)

Detect returns the best available Runtime. Priority: podman → docker → built-in rootless. Pass override = "" to use auto-detection; pass "cli" or "rootless" to force.

func NewRootlessRuntime

func NewRootlessRuntime() (Runtime, error)

NewRootlessRuntime returns the built-in rootless Runtime (Linux only).

type RuntimeType

type RuntimeType = runtimetype.RuntimeType

RuntimeType identifies which container backend is in use.

Directories

Path Synopsis
internal
runtimetype
Package runtimetype defines the RuntimeType enum shared between the container package and its sub-packages to avoid import cycles.
Package runtimetype defines the RuntimeType enum shared between the container package and its sub-packages to avoid import cycles.
Package rootless implements a daemon-free container runtime for YAP using go-containerregistry for image pulls and rootlesskit for isolated execution.
Package rootless implements a daemon-free container runtime for YAP using go-containerregistry for image pulls and rootlesskit for isolated execution.

Jump to

Keyboard shortcuts

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