Expand description
Local-container runtime: detect an orbstack/docker-desktop/colima/podman/docker
socket per .yah/infra/providers/orbstack.toml, then drive appliance containers
(miniflare, MinIO) for the pond mirror shape.
Shells out to the docker CLI rather than linking a Docker REST client.
OrbStack, Docker Desktop, Colima, and Podman all expose a Docker-compatible
socket; the call sites here are few enough that per-invocation process
overhead is invisible inside the container spin-up budget (few seconds).
§Provider cascade
RuntimeProvider is the probe contract each back-end implements.
LocalContainerSpec::build_cascade returns the ordered provider list;
LocalRuntime::detect walks it and picks the first available one.
Default Auto order: OrbStack → Docker Desktop → Colima → Podman → Docker →
custom DOCKER_HOST.
§Module shape
LocalContainerSpeccarries a runtime preference + socket discovery map. The cloud crate provides thekind = "local-container"ProviderConfig adapter viacloud::local_container_spec_from_provider.LocalRuntime::detectprobes sockets in preference order, expands~in paths, and returns a handle that downstream callers feed every docker invocation through.LocalRuntimeexposes the lifecycle primitives R256-T3 will compose into a reconciler:ensure_image,run,stop_and_remove,container_state,list_owned.
§Container naming + orphan cleanup
Every container this module starts gets:
- A canonical name:
yah-pond-<service>-<env>-<slot>viacanonical_name. Theyah-pond-prefix is grep-friendly indocker psoutput. - A docker label
yah.pond = <service>:<env>:<slot>for filtered queries viadocker ps --filter label=yah.pond.
After a crash that misses graceful shutdown, LocalRuntime::list_owned
enumerates leftovers and the caller can reap them before starting a fresh
up cycle.
@yah:relay(R275, “Tier 2 — Container substrate: provider trait + non-orbstack fallbacks”)
@yah:at(2026-05-21T21:56:51Z)
@yah:status(review)
@yah:parent(Q273)
@yah:next(“F1: promote local_runtime probe into RuntimeProvider trait with explicit OrbStack / Docker Desktop / Colima / Podman / custom DOCKER_HOST providers (per visiting doc)”)
@yah:next(“F2: settings-panel UX surfacing Detected/Current/Mode in rig-prefs”)
@yah:next(“F3: spike built-in macOS VM via Virtualization.framework — go/no-go + scoping estimate; defer build until a real ‘Nothing found’ case”)
@yah:next(“F4: route reconciler/local_sim.rs Caddy+MinIO path through the new trait (currently calls orbstack-via-docker-CLI directly)”)
@yah:gotcha(“Today only orbstack-via-docker-CLI is exercised in practice; the cascade exists implicitly. Don’t assume other backends work until F1 lands.”)
@arch:see(visiting/container-runtime-strategy.md)
@arch:see(.yah/docs/working/W080-dev-yah-static-demo.md)
@arch:see(.yah/docs/architecture/A031-yah-cloud-config-shape.md)
@yah:handoff(“F1 + F4 landed: RuntimeProvider trait (name/available/docker_host), SocketRuntimeProvider, CustomDockerHostProvider — all in local_runtime.rs. RuntimePref/DetectedRuntime expanded with DockerDesktop, Podman, Custom variants. LocalContainerSpec gains custom_docker_host: Option
Structs§
- Container
RunSpec - Run-time spec for a single container managed by
LocalRuntime::run. - Custom
Docker Host Provider RuntimeProviderfor a rawDOCKER_HOSTstring supplied by the operator (e.g."tcp://localhost:2375"or"unix:///path/to/custom.sock"). Always reported as available — the operator opted in explicitly; failures surface as docker CLI errors rather than probe misses.- Local
Container Spec - Probe spec lifted from a
kind = "local-container"provider TOML. - Local
Docker Runtime WorkloadRuntimeimplementation backed by the docker CLI.- Local
Runtime - Reachable local container daemon — the winning provider from the cascade.
- Owned
Container - A container managed by this module, as observed via
LocalRuntime::list_owned. - Socket
Runtime Provider RuntimeProviderbacked by a Unix socket path. Available iff the tilde-expanded path exists on disk.
Enums§
- Container
State - Container State.Status from
docker inspect. Anything the docs don’t enumerate lands in [Unknown]. - Detected
Runtime - Which runtime answered the probe cascade.
- Runtime
Pref - Operator-declared runtime preference from the provider TOML’s top-level
runtimefield.autowalks the full cascade; any pinned value probes only that runtime.
Constants§
- LABEL_
KEY - Docker label key applied to every container this module owns. The value
is
<service>:<env>:<slot>sodocker ps --filter label=yah.pond=<v>scopes orphan cleanup to a specific mirror. - LEGACY_
LABEL_ KEY - Legacy label key from before the sim→pond rename. Used by
list_ownedto detect old-generation containers during the transition period. - LEGACY_
NAME_ PREFIX - Legacy name prefix from before the sim→pond rename (R362-F5). Used by orphan reconciliation to detect and reap old-generation containers.
- NAME_
PREFIX - Canonical name prefix for every container managed by this module.
Traits§
- Container
Launcher - The three container operations the pond bring-up sequences need, factored
out of
LocalRuntimeso a caller can supply a different launcher. - Runtime
Provider - Probe contract for a single Docker-compatible runtime back-end.
Each implementation knows its socket path (or raw
DOCKER_HOST) and can report whether it is currently reachable.
Functions§
- canonical_
label - Build the canonical label value for the same triple.
- canonical_
name - Build the canonical container name for a (service, env, slot) triple.
- pond_
network_ name - Canonical per-cell bridge network name. Every container in a pond cell
(MinIO, miniflare, mesofact-dev, …) joins this network so they reach each
other by their
--network-alias(R455-F1). One network per (service, env) pair lets two services’ ponds coexist without per-port collision juggling.