Documentation
¶
Overview ¶
Package runtime detects the local container runtime (Docker, OrbStack, Podman) and reports its name, binary path, version, and enterprise-mode hint.
nSelf supports any container runtime that exposes a Docker-compatible CLI. Detection probes binaries in priority order (docker, orb, podman) and uses the first one found on PATH. Callers should use Runtime.Binary instead of hardcoding "docker" so OrbStack and Podman users get first-class support.
Index ¶
Constants ¶
const ( NameDocker = "docker" NameOrbStack = "orbstack" NamePodman = "podman" )
Name constants for the supported runtimes. Stored on Runtime.Name so callers can branch on a known set instead of parsing strings.
Variables ¶
var ErrNoRuntime = errors.New("no container runtime found (install docker, orbstack, or podman)")
ErrNoRuntime is returned by Detect when no supported container runtime is found on PATH.
Functions ¶
This section is empty.
Types ¶
type Runtime ¶
type Runtime struct {
// Name is one of NameDocker, NameOrbStack, NamePodman.
Name string `json:"name"`
// Binary is the absolute path to the runtime's CLI executable. Use this
// instead of hardcoding "docker" when invoking exec.Command.
Binary string `json:"binary"`
// Version is the runtime's reported version string (e.g., "24.0.6").
// Empty when the version probe fails; detection still succeeds in that case.
Version string `json:"version"`
// IsEnterprise is true when the runtime is Docker Desktop running with an
// enterprise (paid) plan. Used to surface a license-compliance warning for
// organizations >250 employees.
IsEnterprise bool `json:"is_enterprise"`
}
Runtime describes a detected container runtime.
func Detect ¶
Detect probes PATH for a supported container runtime and returns a populated Runtime on success. It uses a 5-second timeout when probing version and enterprise mode so a stuck daemon does not hang the caller.
func DetectContext ¶
DetectContext is the context-aware variant of Detect. Callers running inside a wider operation (e.g., nself doctor) should pass their own context so the probe respects upstream cancellation.
func (*Runtime) EnterpriseWarning ¶
EnterpriseWarning returns a human-readable warning string for organizations running Docker Desktop's enterprise tier without a paid subscription. Empty when no warning applies.