# apple/container — AlpLab Radar Static Code Audit

- Ring: `adopt`
- Category: `dev`
- Overall score: `4.0/5`
- Implementation check: `verified`
- Maturity: `active`
- Audited commit: `16e8d488ee1d` (read-only; nothing from the repository was executed)
- Reviewed at: 2026-11-30T12:43:25Z
- Repository: https://github.com/apple/container
- Radar entry: https://radar.alplab.co/#repo/apple/container
- License: `Apache-2.0`
- CI workflows: `.github/workflows`
- Tags: `containers`, `oci`, `virtualization`, `macos`, `swift`, `apple-silicon`

## Summary

Apple's Swift CLI/system for running OCI Linux containers, each in its own lightweight VM via Virtualization.framework, with launchd/XPC helper services, a BuildKit-style remote builder, DNS and port-forwarding plumbing

## Implementation Check

Code fully implements the README: ContainerRun.swift -> ContainerClient XPC -> ContainersService -> RuntimeService.swift boots a per-container VM (VZVirtualMachineManager) and runs the OCI image; pull/build/push, volumes, networks, machines and clusters all have real implementations, not stubs

## When to Use

Running or building Linux OCI containers on an Apple Silicon Mac (macOS 26+ recommended); not for Intel Macs, older macOS without workarounds, or when you need Docker-API/socket compatibility or Docker Compose

## Sub-scores

| Dimension | Score |
|---|---|
| quality | 5.0/5 |
| usability | 4.0/5 |
| reliability | 3.0/5 |
| security | 4.0/5 |
| integration | 4.0/5 |

## Code Evidence

Sources/Services/RuntimeLinux/Server/RuntimeService.swift (real VM lifecycle: bootstrap, startProcess, stop, copyIn/copyOut, socket forwarders, capability handling); Sources/APIServer/APIServer+Start.swift wires 19 XPC routes plus two localhost-bound DNS servers; Package.swift declares 20+ targets and 15+ testTargets; ~90 test files under Tests/ (unit + integration suites that boot VMs in CI, .github/workflows/common.yml runs make test install-kernel integration with coverage); kernel download pinned by sha256 digest and digest is mandatory for non-default kernel URLs (ContainerSystemConfig.swift KernelConfig); XPC server rejects clients whose EUID differs from the server's (XPCServer.swift handleMessage)

## Issues Found

Maturity signal says tests:false, but the tree contradicts it: Tests/ holds ~90 test files, Package.swift declares 15+ testTargets, and CI runs unit plus VM-booting integration tests with coverage — the signal is wrong, not the repo. HostDNSResolver.swift shells out to /usr/bin/killall -HUP mDNSResponder and writes /etc/resolver files, which presumes elevated privileges from the installed service; failure modes there degrade host DNS UX rather than security

## Key Risks

Nothing was executed, so no runtime behavior is proven here. Apple-silicon only; macOS 26 or later is the supported target (macOS 15 has documented networking limitations, docs/technical-overview.md). No memory ballooning reclaim. The cluster subcommand is explicitly experimental and can break compatibility. container machine deliberately trades away container isolation (home dir mounted rw, all capabilities, passwordless sudo, SSH agent forwarded) — documented loudly in docs/container-machine.md, but it is the feature the X post celebrates. Registry passwords go to the macOS Keychain; first run downloads a kernel from GitHub releases (digest-pinned). Installer needs admin and writes /etc/resolver files and HUPs mDNSResponder (HostDNSResolver.swift)

## Reviewed Files

- `README.md`
- `BUILDING.md`
- `Package.swift`
- `Makefile`
- `docs/technical-overview.md`
- `docs/container-machine.md`
- `.github/workflows/common.yml`
- `Sources/CLI/ContainerCLI.swift`
- `Sources/ContainerCommands/Container/ContainerRun.swift`
- `Sources/APIServer/APIServer+Start.swift`
- `Sources/Services/RuntimeLinux/Server/RuntimeService.swift`
- `Sources/Services/ContainerAPIService/Client/Utility.swift`
- `Sources/Services/ContainerAPIService/Client/HostDNSResolver.swift`
- `Sources/ContainerXPC/XPCServer.swift`
- `Sources/ContainerPersistence/ContainerSystemConfig.swift`
