10 min readPost 37
Landing Podman as a second container runtime: zero core ledger changes, two real bugs caught before merge
On 30 November we landed Obituary’s first non-Docker external resource provider (standalone non-Pod Podman containers) on top of the stdlib-only extres contract with zero core reverse imports and v18 ledger compatibility. Along the way, real Ubuntu 26.04 + Podman 5.7.0 CI caught the empty CONTAINER_HOST remote-mode trap, and cross-platform review caught a Podman Machine --url bug that silently dropped SSH credentials.

On this page
Obituary began by attaching countdowns to local files and directories, moving expired items into a restorable graveyard for 7 days before permanent removal. Later we extended that same safety net to Docker containers and local volumes: expired containers stop instead of disappearing, keeping their writable layers intact until retention runs out.
Not every developer machine runs Docker. Switch a workflow to rootless Podman on Linux, or run Podman Machine on Windows and macOS, and throwaway containers spun up during an AI coding session still pile up silently. The architectural catch is obvious: if every new container runtime forces a fresh wave of if kind == "podman" branches through the ledger, lifecycle engine, obit doctor, and background discovery, the codebase collapses under runtime-specific special cases.
On 30 November we plugged our first non-Docker provider (standalone Podman containers) into the standard-library-only internal/core/extres contract (3d6cafc, 9e6677b, 92feb4e, 26253ab, b3c0aab). The interface held up cleanly, and the real payoff came right after: Ubuntu 26.04 CI and a cross-platform code review caught two sharp bugs before merge.

Putting the interface to the test, and why scope stops at standalone containers
The only honest test of an abstraction is landing a second implementation with different operational quirks.
internal/podman (kind: "podman-container") implements seven composable traits from internal/core/extres: Provider, RetentionPolicy, IdentityMatcher, RemovalVerifier, AvailabilityScoper, Doctor, and Discoverer. None of core/extres, core/ledger, core/lifecycle, or auto imports internal/podman.
The ledger schema didn't need a version bump either. Tracked items, burials, and proposal candidates reuse optional external credentials alongside externalIntents on the existing v18 ledger, leaving every v14–v18 Docker container and volume record untouched. Mutations keep the exact same safety discipline: write a durable pre-send intent, invoke podman stop / start / rm outside ledger locks, then read back the live container to verify its full 64-character ID and creation time.
The harder design call was setting a strict admission line. Podman users lean heavily on Pods and podman kube play, where multiple containers share a network namespace and an infra pause container. Stopping one member out from under a Pod leaves the group half-broken.
So we enforced one hard product boundary in code: standalone non-Pod containers only.
- Any container with
Pod,PodName,IsInfra, orkube play'sIsServiceset, or launched with--rm(AutoRemove, which makes the engine delete the writable layer as soon as it stops), is rejected across registration, verification, stop, start, removal, and session discovery. - Pods, images, volumes, build caches, and Podman Machine VMs are never touched.
- When
podmanis not installed or unreachable, session discovery skips quietly,obit doctorreportspodmanasINFO(never a false warning), andapp.ProposalViewsscopes live probes viaAvailabilityScoperto mark pending proposalspodman-unavailableuntil the engine comes back.
First lesson from real CI: Podman 5.7 treats empty CONTAINER_HOST="" as remote mode
Every unit test against our fake Podman subprocess passed locally. Then we ran the five real-engine E2E contracts on Ubuntu 26.04.1 LTS with podman version 5.7.0, and reality hit back on the first run.
To isolate the test containers from host storage, the E2E harness cleared inherited remote variables with t.Setenv("CONTAINER_HOST", "") and t.Setenv("CONTAINER_CONNECTION", ""). Every podman call immediately failed.
The reason is subtle: Podman 5+ checks whether CONTAINER_HOST is present in the environment, not whether it is non-empty. Leaving CONTAINER_HOST= set to an empty string flips local rootless Podman into --remote mode.
That wasn't just a test-harness quirk. Any user shell with a leftover export CONTAINER_HOST="" would break local obit podman in the exact same way. In 92feb4e we closed it on both sides:
- Strip empty vars before local execution:
cleanEmptyTargetEnv()ininternal/podman/target.goremoves emptyCONTAINER_HOSTandCONTAINER_CONNECTIONentries from the child process environment whenever Podman runs in local mode. - Real
os.Unsetenvin E2E and strict detection in unit tests: The E2E harness switched toos.Unsetenv(restoring prior state on cleanup) and pinneddriver = "overlay"in its isolatedstorage.conf. Later inb3c0aab, the fake Podman test binary switched toos.LookupEnvso a leaked empty variable fails unit tests right away too.
That first real-runner pass shook out two other practical bugs: the E2E suite had to resolve /usr/bin/podman directly instead of inheriting a test stub on PATH (9e6677b, which also split podman_env_test.go out to keep files concise, alongside updating obit doctor's row-count test for the new podman check), and Contract 1 initially advanced the fake clock by 48 hours (short of the 3-day LeftoverLifespan, or 72 hours, on approved container proposals) before 26253ab bumped it to 8 days so expiry stop and pre-retention purge refusal actually fired.
Cross-platform review caught a blocker: --url drops Podman Machine SSH keys
With Linux CI completely green, reading internal/podman/target.go from a Windows and macOS perspective uncovered a bug that would have failed outright on Podman Machine (b3c0aab).
On Linux, rootless Podman talks directly to local storage (podman info reports host.serviceIsRemote: false). On Windows and macOS, podman talks to a Podman Machine VM in implicit remote mode (serviceIsRemote: true), with neither CONTAINER_HOST nor CONTAINER_CONNECTION set in the environment. Under the hood, Podman reads the default named system connection to find the SSH key (Identity) and endpoint.
To pin containers to their originating engine, our initial targetFromInfo had a fallback that looked harmless on paper:
if base.URL == "" && base.Connection == "" && mode == "remote" && remoteSocket != "" {
base.URL = remoteSocket
}Linux CI never exercised that branch, and on Podman Machine it breaks every follow-up action.
info.Host.RemoteSocket.Path is the guest socket path (without connection credentials). Writing it into Target.URL caused every later podman stop, start, and rm to pass --url <remoteSocket.path>. Passing --url bypasses Podman's named connection config, dropping the SSH identity key and machine routing, so expiry stop and resurrection would both fail to connect.
The fix stops inventing --url values and asks Podman for the active default connection instead:
- When
serviceIsRemoteis true and no explicitCONTAINER_HOSTorCONTAINER_CONNECTIONis set,bind()queriespodman system connection list --format json(defaultConnection()), picks the entry withDefault: true, and pinsTarget.Connectionso follow-up calls pass--connection <name>with SSH identity intact. - If no default named connection is reported,
Target.URLandTarget.Connectionstay empty and Obituary pins the remote target byremote://<graphRoot>(orremote://default) plusEngineID, instead of fabricating a broken--url.
Five more edges tightened in the same review pass
Walking the state machine line by line in b3c0aab closed five smaller gaps as well:
kube playIsServicerejection everywhere:Container.InPod()now checksIsServicealongsidePod,PodName, andIsInfra, enforcing refusal acrossInspect,Verify,Stop,Start,Remove, andDiscover.CLI.Startalso refuses--rmcontainers: Closing admission parity on the resurrection path.- Never-started containers can actually be purged: A container created with
podman createand never started has an emptyStartedAtat burial. The firstReclaimed(stopped)returned an error wheneverstopped.StartedAt == "", stranding never-started containers forever. Now a zeroStartedAtthat stays stopped and zero at purge is safely removable, while starting the container even once (running or non-zeroStartedAt) marks it reclaimed and protects it. - Re-checking
DueinsideBeforeSendunder the ledger lock: Previously, if a user ranobit extendorobit sparein the window betweenVerifyand launchingpodman stop, Obituary still stopped the container and had to restart it via compensation.markExternalStopSentnow re-checkssameExternalItemandDue(now)inside the lock before spawningstop, skipping cleanly with zero bounce. - Real
Validatein auto-discovery tests: Replacing an always-nil stub withpodman.ContainerProvider.Validateso malformed IDs and empty payloads are rejected in discovery tests too.
Five real-engine E2E contracts in an isolated rootless store
The podman-e2e CI job runs alongside the existing shards. It provisions a private temporary storage.conf, containers.conf, and XDG_* tree, verifies isolation via verifyIsolatedGraphRoot, pulls busybox:1.36, and runs five end-to-end contracts in 49.11 seconds:
- Ownership attribution, full-ID pinning, and expiry stop (10.52s): Starts a bind-mounted container, a
compose working_dir-labeled container, an unattributed container, and a pre-session container; session finish proposes only the two project-owned ones, expiry stops only those two, and pre-retentionobit purgeis refused. - Lossless resurrection within retention (7.85s): Writes a sentinel into
/tmp/obit-layer.txt, stops on expiry, resurrects withobit resurrect, and reads the intact writable layer back viapodman exec. - Purge preserves named volumes and base image (10.12s): Mounts a populated named volume, advances past the 7-day retention window, lets
Tickrunpodman rm(without-vor-f), and verifies the container is gone while the volume sentinel and base image ID remain untouched. - Manual restart,
StartedAtdrift, and same-name swap protection (15.77s): Tests a buried container restarted and still running, one restarted then manually stopped (StartedAtdrifted), and one removed externally and replaced by a fresh container with the same name;Tickprotects all three without touching the replacement. - Pod member and
--rmrefusal (2.94s): Launches both a Pod member and an--rmcontainer bind-mounted to the repo;AddExternalreturnsErrPodMember/ErrAutoRemove, and sessionFinishproduces zero proposals.

Two takeaways stick from shipping this provider. First, extres absorbed a second real container runtime without leaking a single Podman import back into the ledger, lifecycle, auto, or obit doctor. Second, unit tests, Linux real-engine CI, and cross-platform code review each catch a completely different class of failure: empty CONTAINER_HOST="" came from real Podman 5.7 behavior, while the Podman Machine --url credential bug could only be spotted by reading target resolution through Windows and macOS eyes.