Repository navigation
Description
Goal
Design and implement the backend abstraction so Contained can keep Apple container support stable while adding Docker and future runtime support without duplicating UI and command plumbing.
Parent: #32
Current status (July 18, 2026)
Implemented in PR #48 at 99537804; Core, app, release-bundle, native Xcode, and CodeQL verification are green.
ContainedCore is now the single backend/orchestration package the app talks to. It owns Core.* runtime descriptors/capabilities, canonical container/image/network/volume/metrics models, command previews, command execution, Compose import/export semantics, typed display-neutral errors, semantic Core localization, migration planning/execution surfaces, and concrete adapter internals.
Runtime implementation folders are concrete and sibling-shaped:
Runtimes/AppleContainerfor Applecontainer.Runtimes/Dockerfor Docker CLI-backed adapter groundwork.
Shared runtime contracts and the built-in module registry live under Core Runtime/. The app no longer imports standalone runtime or Apple/Docker adapter packages. App stores call Core.Orchestrator, resource records carry runtimeKind, and actions route through the owning runtime. No global active/default runtime remains; no-context create/import/load/build flows choose a runtime at the action surface.
Docker is intentionally dormant in the default registry for this release posture. The Docker adapter remains covered by explicit module/client injection tests, but the app does not probe Docker, show Docker settings, or offer Docker action targets by default until Contained chooses an independent provider/daemon model.
This issue can close with PR #48. The runtime-first scope and automated acceptance are complete; manual app/UI polish is deferred follow-up work and is not a merge gate. Future non-Docker runtimes, a Contained-owned Docker provider, and optional app-owned OCI cache work should be tracked separately; #50 covers the OCI cache.
Design direction
The app talks to Core.Orchestrator and semantic Core.* models. Runtime-specific implementations live inside Core runtime domains, declare capabilities, translate imports/exports through canonical fields, preserve unsupported runtime-specific projections, and return typed reports/errors for app-owned Activity/UI presentation.
Runtime import translates image/Compose input for the selected runtime into standardized create/edit fields that the app can expose consistently. Runtime projections preserve backend-native context so migration/export can carry safe source-specific fields forward without making the app assemble backend argv or own runtime-specific field semantics.
Research / design checklist
- Inventory current ContainerCommands and ContainerClient call sites.
- Compare Apple container concepts with Compose concepts used by the app.
- Identify operations that cannot be represented identically and document adapters or capability flags.
- Decide whether backend support belongs in ContainedCore or a separate runtime package.
- Decide concrete runtime folder naming (
AppleContainer,Docker) and persisted runtime kind values. - Decide how runtime identity flows through app-owned persistence and UI-facing stores.
- Decide the release posture for Docker when Docker Desktop cannot provide independent daemon ownership.
Implementation checklist
- Keep SwiftUI from assembling backend argv inline.
- Keep pure decision logic testable outside the app target.
- Preserve existing Apple container behavior while abstractions are introduced.
- Add focused tests for command construction and unsupported capability handling.
- Update docs/wiki when runtime backend behavior or support policy changes.
- Add a runtime-neutral create/recreate request model before exposing backend selection in UI.
- Add runtime descriptors and runtime-scoped routing.
- Route image defaults and Compose import through selected-runtime translation.
- Add Docker adapter command builders, decoders, translators, CLI lookup, descriptor, and tests.
- Keep Docker dormant in the default runtime registry until the provider model is chosen.
- Add migration planning/execution behavior before enabling runtime moves.
- Remove global active/default runtime behavior.
Acceptance criteria
- SwiftUI does not assemble backend argv inline.
- Pure decision logic stays testable outside the app target.
- Existing Apple container behavior remains compatible.
- Runtime selection UI is backed by runtime-neutral models and descriptors.
- Docker behavior has focused golden argv, fixture decode, schema/Compose, and orchestrator tests through explicit injection.
- Runtime-scoped resources preserve same-name resources across runtimes.
- Create/build/load/import flows choose a runtime at the action surface instead of using a stored default.
Activity
[-]Design backend abstraction for Apple container and Docker-compatible runtimes[/-][+]Design runtime backend abstraction and dormant Docker adapter[/+]