739 Commits
Author SHA1 Message Date
AJ EmoryandGitHub afeceb05d4 Reorganize runtime targets for scalable plugin support (#1577)
## Type of Change
- [x] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
Closes #1569

Separates generic runtime infrastructure from Linux-specific
implementation into distinct SPM targets:

- ContainerRuntimeClient — generic runtime plugin client API
- ContainerRuntimeLinuxClient — Linux-specific types
- ContainerRuntimeLinuxServer — Linux runtime service + interface
strategy implementations

Renames types to reflect the runtime/sandbox distinction:
- SandboxClient → RuntimeClient
- SandboxService → RuntimeService
- SandboxRoutes → RuntimeRoutes
- SandboxKeys → RuntimeKeys

Breaking for external consumers:
- ContainerSandboxService removed, replaced by ContainerRuntimeClient +
ContainerRuntimeLinuxServer
- Public types renamed

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
2026-05-20 12:57:10 -07:00
Saehej KangandGitHub 4f097eb891 [images]: fix image load error to write to stderr and use FilePath (#1570)
- Closes #1535.
- Closes #1573.
2026-05-20 10:46:17 -07:00
Saehej KangandGitHub 38075f3275 [images]: convert save to use FilePath (#1574)
- Closes #1573.
2026-05-20 10:43:12 -07:00
9895ba8d08 Add container copy/cp command for host-container file transfer (#1190)
## Type of Change
- [ ] Bug fix
- [x] New feature  
- [ ] Breaking change
- [x] Documentation update

## Motivation and Context
Adds the `container copy` (aliased as `cp`) command to copy files
between a running container and the local filesystem.

I saw [#1023](https://github.com/apple/container/pull/1023) and the
feedback from @dcantah — the previous attempt relied on tar being
installed inside the container.
This implementation takes the recommended approach:
file transfers go through the guest agent via the existing
`copyIn`/`copyOut` methods on the core `Containerization`, with no
dependency on container tooling.

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs

---------

Co-authored-by: jwhur <57657645+JaewonHur@users.noreply.github.com>
2026-05-20 10:03:36 -07:00
RajandGitHub bd1916f9b3 Make inspect error handling for missing resources consistent (#1564)
- Closes #1539.
- All `inspect` commands now consistently return
  exit 1 with a clear error when a requested resource
  is missing.
2026-05-16 08:28:37 -07:00
J LoganandGitHub 5b83b4a9ac Rename config file to config.toml. (#1568)
- Closes #1565.
- `runtime-config.toml` suggested the config
  pertains to just the runtime (managing container
  workloads) aspect of the system.
- Also renames `ADDR` columns to `IP` in 
  `container ls` and `container builder status`.
2026-05-16 08:23:21 -07:00
J LoganandGitHub f8f7e2cdf0 Ensure read-only user config removed on every startup. (#1567)
- Closes #1566.
- Currently on `system start` we only remove the read-only user config
if the user config file exists. This means that changes to the config
are processed properly on restart, but a removal is ignored, and the old
read-only settings linger.
2026-05-15 19:43:24 -07:00
RajandGitHub 061ab83bea Validate container system logs --last flag (#1561)
- Closes #1530.

## Type of Change
- [x] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
Reject invalid `--last` values in system logs, matching the format
accepted by `log show`.

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs
2026-05-15 14:23:28 -07:00
RajandGitHub cb4748f589 Reject conflicting volume delete flags (#1560)
- Closes #1531 

## Type of Change
- [x] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
Reject explicitly supplied volume names when `--all` is passed to volume
delete, matching the behavior of container/image/network delete.

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [ ] Added/updated docs
2026-05-15 14:22:40 -07:00
Shaurya SinghandGitHub 64bd48bb9e Reject conflicting DNS flags (#1559)
Rejects conflicting DNS configuration when `--no-dns` is supplied
together with explicit DNS flags.

Fixes #1536.
2026-05-15 09:49:15 -07:00
ChengHao YangandGitHub 5317536888 Fix: image list align with other commands when use format should ignore quiet (#1553)
Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2026-05-15 01:02:07 -07:00
RajandGitHub 16f5fc705f Fix inconsistent volume createdAt JSON encoding (#1556)
- Closes #1533 
- This PR aligns `volume list --format json` date
  encoding with volume inspect by using ISO-8601
  instead of the default numeric reference-date
  format.
2026-05-15 00:59:28 -07:00
J LoganandGitHub 615b5a6ffe Relax host-only network test. (#1552)
- Accept three different curl errors that would indicate container has
no external access.
2026-05-14 14:04:49 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
c1a6d979ba ci: bump actions/labeler from 6.0.1 to 6.1.0 in the github-actions group (#1550)
- Bumps the github-actions group with 1 update:
  - [actions/labeler](https://github.com/actions/labeler).
- Updates `actions/labeler` from 6.0.1 to 6.1.0

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-14 08:57:30 -07:00
AJ EmoryandGitHub 521df518e2 Add variant Support (#1548)
- This change adds two types to support opaque runtime
  data passing through the APIServer:
  - RuntimeConfiguration `data`
  - RuntimeLinuxData type
- LinuxRuntimeData defines runtime specific information.
  With this change, it will support `variant` only. The
  optional RuntimeConfiguration `data` field encodes
  runtime specific data to pass through the APIServer.
  It is decoded as needed by the runtime.
- The idea is to eventually move all runtime specific data
  into the `data` field so that the APIServer is only aware
  of generic container information.
2026-05-12 18:44:56 -07:00
J LoganandGitHub b466959644 Remove IP allocation from API server. (#1545)
- Closes #1318.
- Closes #1378.
- Reduces the complexity and coupling for IP allocation.
- Runtimes connect to networks for the life of the running container.
The runtime shuts down on connection loss.
- Networks automatically deallocate a runtime's IP address and hostname
record on connection loss.
- Removes AllocatedAttachment as this is no longer necessary. The
`bootstrap()` XPC now takes a `NetworkBootstrapInfo` array which
parallels the attachments in the bundle config and provides the network
plugin attributes needed to create VM network interface configurations.

## Type of Change
- [x] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
Simplify IP allocation and make deallocation more reliable.

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
2026-05-12 16:34:06 -07:00
jwhurandGitHub 8a46476341 Bump containerization to 0.32.1 (#1549) 2026-05-12 15:31:46 -07:00
Noah ThorntonandGitHub a967399d48 Add support for layered and plugin configurations (#1543)
- This adds support for reading configurations from
  a three layer hierarchy:
  1. User provided TOML
  2. Install root TOML
  3. Code defaults
- We add some code to support plugin configurations
  via the ConfigurationLoader. Each plugin can provide
  a struct with an accompanying id that gets used to
  parse the scoped section of the TOML.
2026-05-12 14:35:21 -07:00
Chris GeorgeandGitHub 940fefb7cd Use SystemPath for ContainerResource.Filesystem. (#1523)
- Closes #1521.
- Using URL for filesystem paths is bad practice. FilePath is safer and
more ergonomic.
- Same pattern as #1480 (HostDNSResolver) and #1518 (PacketFilter).
2026-05-12 12:35:02 -07:00
J LoganandGitHub c56a659d33 Use allocate with session to automatically clean up IPs. (#1544)
- Part of #1318.
- Part of #1378.
- Removes network plugin `deallocate()`, and allocate takes an
`XPCServerSession` that registers an `onDisconnect` handler that
performs deallocation.
- ContainerService now tracks `networkSessions` for allocations.
2026-05-11 23:08:48 -07:00
J LoganandGitHub 1794afc449 Adds XPC sessions with disconnect handlers. (#1524)
- Part of #1318.
- Part of #1378.
- `RouteHandler` now accepts an additional `XPCServerSession` which
include a disconnect handler.
- `XPCServer` configures a session for each client connection and passes
it to every route handler.
- `XPCServer.route(fn:)` can be used to wrap existing route handlers
that don't care about sessions.
- `XPCClient` adds functions to support client-side session handling.
- Update all existing routes.
2026-05-11 15:49:05 -07:00
Chris GeorgeandGitHub 509fa047dc Use SystemPath for DirectoryWatcher. (#1522)
- Closes #1520.
- Using URL for filesystem paths is bad practice. FilePath is safer and
more ergonomic.
- Same pattern as #1480 (HostDNSResolver) and #1518 (PacketFilter).
2026-05-11 15:06:32 -07:00
Noah ThorntonandGitHub cec58654ac Fix PR coverage comment never posting (#1541)
There is a bug in the artifact downloading where a single artifact
matching a pattern is extracted flat to the working directory without
creating a subdirectory. This meant the glob
`pr-coverage-*/pr-number.txt` never matched, silently skipping the
comment step on every run.

Fixed by using `merge-multiple: true` with an explicit `path`, giving a
deterministic download location regardless of artifact count.

## Type of Change
- [X] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
Fix the GitHub actions to post coverage numbers

## Testing
- [ ] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
2026-05-11 12:26:53 -07:00
Noah ThorntonandGitHub beb1592c04 swift-configuration decoder (#1447)
This adds a swift Decoder that decodes from a swift-configuration
ConfigSnapshot, and adds the ability to modify how select types are
decoded within the
ConfigSnapshotDecoder. This is something that JSONEncoder already does
with URLs specifically, however this enables users to configure this
behavior for any arbitrary type regardless of existing Codable
conformance.

The decoder will help us expand on top of (pr:
https://github.com/apple/container/pull/1425), which switches user
configuration to TOML. With this PR we will be able to provide a multi
layered TOML if desired, allowing container to ship a default TOML
instead of encoding them in code constants.
2026-05-08 17:06:04 -04:00
Chris GeorgeandGitHub af8071bf04 Use SystemPath for PacketFilter. (#1518)
- Closes #1517.
- Using URL for filesystem paths is bad practice. FilePath is safer and
more ergonomic.
- Sibling of #1480 (HostDNSResolver), same pattern.
2026-05-08 12:58:02 -07:00
Noah ThorntonandGitHub 0328f5c4c5 Centralize utilities for configuration loading and path parsing (#1448)
This creates a more centralized utility to find and load configuration files, as a follow up to (pr: https://github.com/apple/container/pull/1425).
2026-05-08 12:29:28 -04:00
Noah ThorntonandGitHub 3b724aecf5 De-duplicate building during testing (#1507)
This utilizes swift test `--skip-build` in combination with a single big
swift test compilation step. By doing this we reduce duplicated swift
compilation between unit and integration.

## Type of Change
- [ ] Bug fix
- [X] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
Coverage GitHub action is taking too long, so hopefully reducing
duplicated work decreases time.

## Testing
- [X] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
2026-05-05 22:12:57 -07:00
iliyaandGitHub 70e05ddf99 docs: fix typos and polish README wording (#1499)
Fixed minor typos and improved wording in the README for clarity and
consistency.
2026-05-05 09:25:46 -07:00
Noah ThorntonandGitHub e3c49803a0 Move to TOML configuration for defaults (#1425)
- Discussion topic #1336.
- This change migrates away from using `UserDefaults`,
  instead providing a TOML configuration mechanism for
  user configurable settings. All existing system property
  settings keys are supported in the new configuration
  file. However, users will have to migrate any settings
  they have configured in the `UserDefaults` into TOML
  for these settings to take effect.
- Breaking changes:
  * `container system property get` is removed in favor of
    users directly utilizing `container system property list --format toml | jq<>`.
  * `container system property set` is removed since the TOML
    configuration is effectively immutable during the lifetime of the
    `container` daemon. Uses can edit the TOML they have in their home
    directory, however no changes will take effect until the daemon is
    restarted via `container system stop && container system start`
* `container system property list --format table` is removed as
    generating tabular format is non-trivial and the new TOML format is
    intended to be human readable
2026-05-04 12:04:24 -07:00
Danny CanterandGitHub 8a25213190 Deps: Bump CZ to 0.32.0 (#1498)
Signals changed from being raw ints to a new Signal type.
2026-05-04 11:30:11 -07:00
Noah ThorntonandGitHub d12d64d488 Change PR build to generate coverage and comment it (#1474)
This extends the github actions to by default run the coverage
generation targets. The targets will generate the coverage artifacts,
which will then be used by a seprate github action to comment on the PR
the coverage numbers.

This is a sanity check for testing information for new features and
refactors alike. It will allow reviewers to quickly identify if there
are major issues with new tests, or large changes to coverage percentage
that indicate a problem.
2026-05-04 11:10:02 -07:00
Saehej KangandGitHub 2ee3f3d0a1 [scripts]: add prompt for updating container with unsigned package (#1468)
Closes #1467 and some minor QOL updates
2026-05-01 17:04:35 -07:00
J LoganandGitHub 9f4e779421 Switch NetworksService, VolumesService, EntityStore to FilePath. (#1493)
- Closes #1485.
2026-05-01 14:39:03 -07:00
Kathryn BaldaufandGitHub e57c755911 Simplify the serial suite trait (#1497)
## Motivation and Context
The `SuiteGate` actor introduced for the serial test trait in
https://github.com/apple/container/pull/1489 could be simplified using
containerization's
[AsyncLock](https://github.com/apple/containerization/blob/f2c42402e744df992fecb84eb3a82935c6fa01d3/Sources/ContainerizationExtras/AsyncLock.swift#L23).

## Testing
- [ ] Tested locally

Note: working on A/B performance testing to validate this approach does
not significantly impact test run performance.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-05-01 11:38:07 -07:00
Noah ThorntonandGitHub a141002de1 Improve integration test speed (#1489)
This improves the integration test suite speed by running all
integration tests in a single `swift test` invocation. We maintain the
one `@Suite` at a time behavior by introducing a new test trait that
uses a single mutex to limit inter-suite parallelism.
2026-04-30 16:20:06 -07:00
Danny CanterandGitHub 06c00a93a2 CLI: Support --shm-size (#1488)
Closes #1484

Allows sizing /dev/shm
2026-04-30 16:10:25 -07:00
J LoganandGitHub e6ba030fca Sort networks by ID in API server list(). (#1487)
Closes #1483.
Consistent well-defined behavior for server APIs.
2026-04-30 15:42:04 -07:00
J LoganandGitHub 1ee2d9d054 Update documents with note about container-to-host networking. (#1482)
- Currently we need to use `pfctl` to create the packet filter rule for
container-to-host networking (`host.docker.internal`). This approach
unfortunately has a few limitations that require documentation.
2026-04-30 15:05:10 -07:00
J LoganandGitHub 5ec28cffe5 Use SystemPath for HostDNSResolver. (#1480)
- Closes #1479.
- Using URL for filesystem paths is bad practice. FilePath is safer and
more ergonomic.
2026-04-30 15:01:12 -07:00
J LoganandGitHub b1f3c0d35b Use NetworkResource for network management in API server. (#1421)
- Part of #1404.
- Evolves API to use NetworkResource that conforms to ManagedResource.
- BREAKING CHANGE - compile time impact due to changes to Swift client
API signatures. No change to persistent data or API server XPC
protocols.
2026-04-30 11:06:50 -07:00
J LoganandGitHub 472cb1950f Build output should just be tags/paths. (#1478)
- Closes #1477.

## Type of Change
- [x] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
stdout should contain results that can be piped

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [ ] Added/updated docs
2026-04-30 10:29:13 -07:00
b73933eb2d Tests/CLITests: drain stdout/stderr concurrently in CLITest.run (#1471)
## Type of Change
- [x] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context

`CLITest.run(arguments:stdin:currentDirectory:env:)` reads stdout to EOF
before stderr begins draining
(`Tests/CLITests/Utilities/CLITest.swift:182-183`). If a child process
writes more than a pipe-buffer's worth of data to stderr (~64 KB on
macOS), the child blocks in `write()` on stderr while we block in
`readDataToEndOfFile()` on stdout, and neither side makes progress until
`process.waitUntilExit()` returns. This is a latent deadlock that any
future test or CLI verbosity bump can trigger.

This PR drains both streams concurrently using `readabilityHandler`
closures backed by `Mutex<Data>` buffers. After
`process.waitUntilExit()` returns the handlers are cleared and
`readDataToEndOfFile()` flushes any bytes the kernel buffered between
the last handler invocation and exit. The error path also clears
handlers so a failed `process.run()` does not leak callbacks. `Mutex`
matches the locking primitive the file already uses for `commandSeq`.

Fixes #1456

## Testing

- [x] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs

`swift build --target CLITests` passes against the change. `make
swift-fmt-check` is clean. Behavior is unchanged for any test command
that previously fit within a single pipe buffer, so the existing
CLITests still exercise the helper end-to-end.

I did not add a new test that emits >64 KB to stderr because every
existing CLITest invocation goes through `executablePath` (the
`container` binary), and reproducing the deadlock requires a child that
emits a controllable amount on stderr. Happy to follow up with a small
refactor that extracts the drain into a static helper plus a regression
test that drives it via `/bin/sh` if that would be useful.

---------

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
2026-04-30 10:28:27 -07:00
f9899013fd Merge commit from fork
* Use DNSName for input

* Use pqdn instead of fqdn.

* Update Sources/DNSServer/Records/DNSName.swift

Co-authored-by: J Logan <john_logan@apple.com>

* Simplify description

* Add test

* Make fmt

---------

Co-authored-by: jwhur <jaewon_hur@apple.com>
Co-authored-by: jwhur <57657645+JaewonHur@users.noreply.github.com>
Co-authored-by: J Logan <john_logan@apple.com>
0.12.3
2026-04-30 09:33:26 -05:00
Patrick LinnaneandGitHub fd2de35440 ensure-container-stopped.sh: don't fail on launchctl errors (#1461)
- Fixes #1281. Supersedes #1306.
- When `-a` runs as a regular user (such as via
  `brew install container`), two launchctl failures
  bubble up as a non-zero exit and break Homebrew's
  post-install:
  - `bootout` against `system` requires root.
  - `launchctl print` lists Mach endpoint names that
    aren't loaded jobs, so `bootout` returns
    `No such process` on them.
- Skip `system` when not root, and treat individual
  `bootout` failures as non-fatal. Same fix applied to
  the non-`-a` `xargs` pipeline.

Signed-off-by: Patrick Linnane <patrick@linnane.io>
2026-04-29 19:42:49 -07:00
bfe587b8e8 ImagePush: print image reference to stdout on success (#1470)
-Resolves #1466.
- `container image push <ref>` previously produced no
  standard output on success. Print the fully qualified
  reference (`image.reference`) after the push completes
  so callers can pipe the output into subsequent
  commands.

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
2026-04-29 19:31:47 -07:00
4e390d6aa8 Fix RequestScheme formatting. (#1473)
## Type of Change
- [x] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
`main` build broke with last commit.

## Testing
- [ ] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs

---------

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
Co-authored-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-04-29 15:04:24 -07:00
J LoganandGitHub 601f5f113a Merge commit from fork
- Don't prefix match localhost, use exact
  match only.
- Only check default local domain if one is
  defined.
- Use IPv4Address for private IP CIDR tests.
2026-04-29 11:46:22 -05:00
Kathryn BaldaufandGitHub e9891b3cfe Allow macOS 15 to list and delete networks (#1464)
- A recent change moved the list and delete
  network XPC calls within an availability check,
  making them only available on macOS 26.
  However, there are some code flows that rely
  on being able to call `list` on the NetworksService,
  including anything that uses `networkClient.builtin`.
- `container` does not officially support macOS 15
  and as a result we do not have GitHub action runners
  for validation on macOS 15. That said, we try to avoid
  breaking compatibility on macOS 15 as much as
  possible.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
0.12.2 0.12.1
2026-04-28 18:26:34 -07:00
J LoganandGitHub 651811cc09 Fix "not installing shadowed plugin" startup log noise. (#1451)
- Closes #1450.
- If we require that bundle-packaged installs must populate a
Unix-structured `bin` and `libexec`, we don't need the code that
searches the app bundle install root. As it stands, we enumerate both
the app bundle and the Linux paths, meaning we're looking at the same
plugins (in different paths) twice.
0.12.0
2026-04-27 11:32:00 -07:00
Kathryn BaldaufandGitHub df25fe25bb Add yams to apple/container's notice file (#1442)
This PR adds yams to the NOTICE file. Yams was introduced in
https://github.com/apple/container/pull/1353.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-04-22 16:08:07 -07:00