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 /project 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
// RunShellCapture is like RunShell but tees stdout+stderr into out
// (typically a bounded buffer owned by the caller — e.g. an MCP build
// session log). Pass nil to fall back to the default sink.
//
// env is forwarded to the container as additional environment variables
// without appearing in the shell argv — use it for secrets like signing
// passphrases that would otherwise leak via `ps`. A nil/empty map is
// equivalent to passing no extra vars.
//
// ctx is honoured by the CLI backend (podman/docker) so cancelling the
// context terminates the container. The rootless backend forwards it on
// a best-effort basis only — rootlesskit's parent loop has no clean
// cancel hook, so cancellation may be observed only after the next
// process boundary.
RunShellCapture(ctx context.Context, distro, workDir, shellCmd string,
env map[string]string, out io.Writer) error
// Type returns the runtime identifier.
Type() RuntimeType
}
Runtime is the interface every container backend must satisfy.
func Detect ¶
Detect returns the best available Runtime. Priority: podman → docker → built-in rootless.
Pass override = "" to use auto-detection. Accepted explicit values:
- "cli": force the system podman/docker CLI (auto-pick between them)
- "podman" / "docker": force that specific CLI backend
- "rootless": force the built-in rootless runner
func NewRootlessRuntime ¶
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. |
Click to show internal directories.
Click to hide internal directories.