Skip to content

Restructure the ContainerSystem as ContainersCore, add networking, in-app help and split Settings - #7

Merged
armartinez merged 5 commits into
try-containers:mainfrom
armartinez:containers-core
Nov 30, 2026
Merged

armartinez merged 5 commits into
try-containers:mainfrom
armartinez:containers-core

Conversation

@armartinez

Copy link
Copy Markdown
Contributor

Important

For all but trivial fixes, make sure to first create a GitHub issue that concisely describes the bug or desired enhancement as justification for the change. Large PRs with no justifying issue will be closed.

Related Issue

Closes #

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

The ContainerSystem split the container system across SystemManager, ContainerRuntime and a plugin loader, and managers returned app-side copies of what they managed. Its model, names and storage now follow Apple's container project, so features developed there are easier to bring to the app.

Containers couldn't reach each other or the Mac by name, and Settings was one long pane. The documentation was only on the website.

Memory profiling found that building images could leave 10 idle threads behind for each failed attempt to connect to the builder.

Description

Framework

  • ContainersCore: the ContainerSystem project is now ContainersCore, laid out by layer: System/ (with its internal Services/), Managers/, Container/, Image/, Network/, Volume/, Common/, Build/.
  • One container system: ContainerSystem.shared replaces SystemManager and ContainerRuntime. It owns the status, the lifecycle, the prerequisites and the settings, and creates its services when it starts and releases them when it stops.
  • One service per domain: ContainerService (split into +Configuration, +Interfaces, +Lifecycle, +Processes and +Streams), ImageService, NetworkService, VolumeService, KernelService, ReportService and DNSService. Managers reach them through the system's throwing …Service properties.
  • Removed: the plugin loader and HTTP2ConnectBufferingHandler.

Resources

  • What managers return: ManagedContainer, ImageResource, VolumeResource and NetworkResource, each a ManagedResource with validated ResourceLabels. The part that's stored is its …Configuration. They replace ImageSummary, VolumeSummary and the app's ContainerItem, ImageItem and VolumeItem.
  • In use: whether an image or volume is in use comes from its own call, ImageManager.digestsInUse() and VolumeManager.namesInUse().
  • Method names: container(withID:), layers(of:platform:), domains(in:), markRead(ids:), isRead(id:) and report(withID:).

Storage

  • Settings file: the system's settings are kept in a config.toml in its folder (SystemConfiguration): the kernel, the init and builder images, build and container CPUs and memory, the DNS domain, the registry and the subnet.
  • Stores: networks and volumes are kept as <name>/entity.json in their own folders.
  • Protected folder: the container CLI's data folder can't be chosen as the storage location, and the system doesn't start in it (ContainerSystem.canStoreData(in:), AppRootError).
  • Interrupted work: what an interrupted download, unpack or build left behind is removed before the system starts.

Networking

  • Networks: NetworkManager creates and deletes networks, and the Network settings pane lists them. Custom networks are hidden for now (NetworkManager.supportsCustomNetworks), since a sandboxed app can't use vmnet without the com.apple.vm.networking entitlement. The default network falls back to the Mac's shared NAT.
  • DNS: DNSService resolves container hostnames for the Mac and the containers, and the localhost domains in /etc/resolver.

App

  • Settings: split into General (open at login, Dock and menu bar, starting the system on open), Network (networks and DNS domains) and Container System (storage location).
  • Help: a help window shows the documentation from the app bundle, so it works offline and matches the app's version. It has a sidebar, search, and back and forward. It opens from Help ▸ Containers Help (⌘?). scripts/update-help.sh copies the website's documentation into Help.bundle.
  • Forms: ContainerCreateForm, ImageBuildForm and VolumeCreateForm hold what's entered in the create sheets. The Create Container sheet is split into General, Process and Management, and the create sheets share one size.
  • Tables: rows are ResourceEntry<Resource> values built by ActivityCenter, with tasks keyed by ResourceID.
  • Status bar: shows CPU, memory, network and disk use (ContainerStatsSummary).
  • Symbols: custom symbols for containers, volumes and the status gauge.
  • Folders: Extensions/ is folded into Models/, Utilities/ and Views/Components/.
  • Image name suggestions: SuggestionTextField replaces the suggestions modifier, and picking the suggestion that's already typed now closes the menu.

Fixes

  • Builder threads: a build now uses one event loop group for every attempt to connect to the builder, and shuts it down however it ends. Before, each attempt created a 10-thread group, and only a completed build shut one down.
  • Builder connections: an attempt that connects but gets no answer from BuildKit closes its gRPC client before retrying. Builder no longer shuts down a group it didn't create.

Docs and CI

  • AGENTS.md: rewritten for the ContainersCore layout, services, resources, forms and naming.
  • README.md and CONTRIBUTING.md: updated.
  • Workflows: the test scheme is now ContainersCoreTests, and the build runs swift-format lint.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

Added AppRootTests, SystemConfigurationTests, ResourceLabelsTests, NetworksTests, DNSServiceTests, FolderEventsTests and ImageManagerTests, and replaced MockContainerRuntime with MockContainerSystem.

Profiled with Instruments' Leaks template, leaks, heap and footprint while building images (failed, cancelled and completed builds), running containers, opening and closing windows, and stopping and starting the system:

  • Build event loop groups left after builds: one per failed attempt before (10 threads each), none after.
  • Footprint: about 73 MB at launch, a peak of about 275 MB during builds, about 130 MB after stopping and starting the system. Three more builds didn't raise it.
  • Services after stopping and starting the system: one of each, so none were kept from before.
  • leaks: 2 leaks for 192 bytes, a vmnet configuration inside Containerization's VmnetNetwork, once per system start.

@armartinez armartinez self-assigned this Nov 30, 2026
@armartinez
armartinez merged commit 892b569 into try-containers:main Nov 30, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant