636 Commits

Author SHA1 Message Date
J Logan ee848e3ebf Add backward compat for ContainerConfig cpuOverhead. (#1665)
1.0 data migration requirement
1.0.0
2026-06-08 15:02:18 -07:00
Raj b2994ac369 Add container machine for managing persistent Linux VMs (#1662)
## Type of Change
- [ ] Bug fix
- [x] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
`container` runs each workload in an ephemeral VM, so there's no
built-in way to keep a persistent Linux environment you can log into and
work in. `container machine` adds one.

A container machine is a lightweight, persistent, and integrated Linux
environments that feel like an extension of your Mac, created from
standard OCI images with a familiar UX. The login user matches your host
account with passwordless `sudo`, your home directory is mounted inside
the VM, and each machine keeps its filesystem and runs the image's own
init system (such as`systemd` or `openrc`).

```bash
container machine create alpine:3.22 --name my-machine
container machine run -n my-machine # interactive shell
container machine set -n my-machine cpus=4 memory=8G
```

Subcommands: `create`, `run`, `list` (`ls`), `inspect`, `set`,
`set-default`, `logs`, `stop`, `delete` (`rm`); `m` aliases `machine`.
Docs added to `docs/command-reference.md` (Machine Management) and
`docs/how-to.md` ("Use container machines").

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

Signed-off-by: Raj Aryan Singh <rajaryan_singh@apple.com>
Co-authored-by: Jaewon Hur <jaewon_hur@apple.com>
Co-authored-by: John Logan <john_logan@apple.com>
Co-authored-by: Michael Crosby <michael_crosby@apple.com>
Co-authored-by: Eric Ernst <eric_ernst@apple.com>
Co-authored-by: Danny Canter <danny_canter@apple.com>
2026-06-08 11:38:49 -07:00
Raj 1b5576312f Increase CI timeout to 75 minutes (#1663)
## Type of Change
- [x] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
Increase CI timeout to 75 minutes

## Testing
- [ ] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
2026-06-08 11:36:20 -07:00
AJ Emory 847a004eac Conform containers to ManagedResource (#1656)
- Closes #1651 
- Adds ManagedContainer that conforms to Managed Resource
2026-06-05 17:27:56 -07:00
Kathryn Baldauf d855978113 Remove duplicated image name in image JSON output (#1655)
https://github.com/apple/container/pull/1652 rearranged the JSON output
for image resources and included a duplicate "name" field. After further
discussion, we've decided to remove the duplicate field.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-06-05 15:11:06 -07:00
J Logan 90cc3c15af Omit hash scheme from image.id. (#1658)
- Closes #1657.
- Also reduces `trimDigest()` output to 12 characters and gets rid of
the trailing ellipsis.
2026-06-05 14:43:20 -07:00
Saehej Kang 1f4b47061e [images]: fix image load/save to use FilePathOps utility (#1590)
- Relates to apple/containerization#744.
- Use the new `FilePathOps` utility functions.
2026-06-05 09:28:08 -07:00
Harshit Singh Bhandari 79f797b879 Auto-install hawkeye in ensure-hawkeye-exists.sh (#1644)
- Fixes #1642.
- The `ensure-hawkeye-exists.sh` now actually
  ensures that hawkeye is installed. If it is not
  installed, the script informs that the installation
  uses `curl | sh` and asks the user to confirm
  before proceeding.
- Automated workflows can bypass the prompt
  by invoking the script with the `-y`/`--auto-install`
  option, or by setting the environment variable
  `HAWKEYE_AUTO_INSTALL=1`.
- Export HAWKEYE_AUTO_INSTALL=1  in every
  Git workflow job that runs make check, to
  ensure license/format checks don't stall.
2026-06-05 09:04:05 -07:00
Raj 48cb23e3b7 Update command ref and how to docs (#1654)
- Closes #1534.
- Updates `command-reference.md` docs to reflect current
  state, and `how-to.md` to the latest images.
2026-06-05 08:36:52 -07:00
Raj 822b47b877 Fix --format yaml and toml output (#1653)
- Closes #1528.
- Several commands (`builder status`, `image list`,
  `stats`, `system df`, `system status`) advertised
  `--format yaml` and `--format toml` but only handled
  `json`, and every other format fell through to the
  table. With this PR, we now route them through one
  shared renderer with an exhaustive switch over the
  format enum, so a missing format would now be a
  compile error, and not just fail silently.
- Since TOML has no top level array, TOML output
  now wraps list payloads under an `items` key,
  because otherwise it was returning nothing for lists.
- `stats` now prints one static result for machine
  readable formats instead of opening its live table
  view.
- `builder status` now returns an empty list for
  json/yaml/toml when no builder is running, instead 
  of the unparseable "builder is not running" text.
  The table view keeps the message.
- with `--quiet` and no builder it now exits 0 with
  no output, earlier it exited non-zero.
2026-06-05 08:32:12 -07:00
Kathryn Baldauf 1d0d43668d Rearrange shape of JSON output for images (#1652)
- This PR changes the shape of the JSON
  output for image resources to align closer with
  `VolumeResource` and `NetworkResource`.
  This includes adding `creationDate` in the
  `configuration` section of the image output.
- This PR additionally cleans up some of the logic
  around the `ImageResource` struct construction.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-06-05 08:09:53 -07:00
Kathryn Baldauf f81dcbf3f9 [Actions] Use commit sha for imported gh actions (#1649)
This PR updates the GitHub workflows to ensure all imported actions are
referenced by commit SHA.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-06-04 15:07:44 -07:00
Harshit Singh Bhandari 8bf87e8890 Make pre-commit hook installation and execution work in git worktrees (#1643)
- Closes #1641.
- This PR replaces the existing hook pathname computation
  for `make pre-commit` with `git rev-parse --git-path hooks/...`,
  which resolves to the shared hooks directory in both the main
  checkout and any worktree.
2026-06-04 14:59:12 -07:00
J Logan 59e015acd1 Use name instead of id in NetworkConfiguration. (#1648)
- Closes #1647.
- `id` will become a system assigned (Docker-like) identifier
  for the managed resource, and `configuration.name` is the
  user-assigned name.
2026-06-04 13:03:29 -07:00
Kathryn Baldauf 25127fdb2a Fix type in memory size format for config docs (#1639)
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-06-04 09:57:30 -07:00
AJ Emory 605045faeb Fix make test SIGSEGV on Swift 6.2 (#1638)
- Closes #1637.
2026-06-03 18:37:16 -07:00
Kathryn Baldauf 3512373541 Add docs on using container system configurations (#1636)
Closes https://github.com/apple/container/issues/1635. Provide tutorial
docs for users to customize default configuration settings.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-06-03 17:44:33 -07:00
J Logan 89fa98c55a Write log/error output from commands to stderr. (#1632)
- Closes #1631.
- The standard output should only contain result data,
  so that scripts consuming stdout don't need to scrape.
2026-06-03 16:17:59 -07:00
Kathryn Baldauf 94d6d0ac36 Add an error message for dockerfile >= 16KB until #735 is resolved (#1634)
Closes https://github.com/apple/container/issues/1633. We have a known
issue https://github.com/apple/container/issues/735 where Dockerfiles
over the size 16kb will fail to build due to "Transport became inactive"
or "Stream unexpectedly closed" errors. While we wait for a fix for
https://github.com/apple/container/issues/735, this PR adds an error
message if a user tries to build an image using a dockerfile >= 16kb.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-06-03 13:02:27 -07:00
Danny Canter 796630258b kill: Wait for container to exit after sigkill (#1589)
Today when we send a signal we don't wait for the container to exit, as
we don't know what signals the program will actually do anything with.
However, sigkill does not fit this mold, and we should wait for the
container to exit (or be removed for --rm containers).
2026-06-02 14:26:17 -07:00
Kathryn Baldauf c7f77c285b Add NOTICE entry for swift-configuration-toml (#1629)
Adds new entry in NOTICE.md for the swift-configuration-toml dependency
added by https://github.com/apple/container/pull/1543

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-06-02 14:19:46 -07:00
Di Warachet S. 4c22305eda Fix TestCLIVersion build-type check for release CI (#1627)
Fix TestCLIVersion build-type check for release CI (#1627)
- Refer to https://github.com/apple/container/issues/1626
2026-06-02 11:02:38 -07:00
J Logan e20aca8203 Normalize JSON output for network and volume resources. (#1624)
Normalize JSON output for network and volume resources. (#1624)
- Reworks both JSON output presets to use sorted keys, ISO timestamps.
`compact` is used for `ls` output, and `pretty` is used for `inspect`.
- Extracts non-DRY option configuration into presets.
- Closes #1623.
2026-06-01 21:42:10 -07:00
Di Warachet S. 34cff5925f Use a consistent container CLI path in integration tests (#1621)
Use a consistent container CLI path in integration tests. See https://github.com/apple/container/issues/1602.
2026-06-01 21:38:10 -07:00
Kathryn Baldauf 55f1e4fdf4 Create ImageResource conforming to ManagedResource (#1619)
- Closes #1625.
- For now, the ImageResource compliance happens
  at the CLI level. We will work on pushing that into or
  closer to the APIServer at a later time.

## Testing
- [x] Tested locally

---------

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-06-01 17:01:20 -07:00
Raj 7358102c68 Fix system df to count content blobs and deduplicate shared storage (#1555)
- Closes #1526 and #1527.

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

## Motivation and Context
This PR fixes `system df` to report actual on-disk allocated bytes
(content blobs + snapshots) instead of summing per-image snapshot sizes.
Orphaned blobs are now included as reclaimable, and storage shared
across tags is no longer double counted. Also consolidates three
identical `calculateDirectorySize` implementations into a shared
`FileManager.allocatedSize(of:)` extension.

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [ ] Added/updated docs
2026-06-01 15:44:43 -07:00
Chris George da8daf31de Use FilePath for PublishSocket (#1594)
- Closes #1593.
2026-06-01 13:35:58 -07:00
J Logan 37595a734c Remove XPC compatibility code, simplify network model. (#1616)
- Refactor network model types: replace `NetworkState` enum and
phase-based NetworkStatus with a flat `NetworkStatus` struct.
- Simplify API server ↔ plugin protocol: plugin `status()` returns
runtime status only, API server owns configuration.
- `NetworksService` `list()`/`create()` now return `NetworkResource`
directly.
- Remove lifecycle phase checks and state machine guards throughout CLI
and API server.
- `variant` is plugin-specific, it's not a required property. This PR
replaces `NetworkPluginInfo` with a `plugin` name property on
`NetworkConfiguration` and an `options` list similar to that for
volumes.
- Moved `variant` to the option list.
2026-05-29 12:33:45 -07:00
Saehej Kang f4f5925c08 [how-to]: fix documentation example (#1596)
- Related to #1534
2026-05-28 15:45:41 -07:00
J Logan c5a8d7a802 Reorganize Swift package targets for network plugin. (#1615)
- Part of #1404.
- Updates containerization to 0.33.2.
- Reorganizes network plugin targets into:
  - `ContainerNetworkClient` - network plugin client and default types
- `ContainerNetworkServer` - separate protocols for `Network` which
manages the underlying virtual network, `NetworkService`, which takes a
network and implements the API, and an actor `NetworkHarness` that
marshals between the API and the XPC protocol. The service-harness
separation will help us ensure XPC protocol compatibility in both
directions as we evolve the plugin APIs.
- Removes `disableAllocator()` which is no longer used since #1545
switched over to using XPC connections between runtime and network
plugin instances to track whether a network has attached containers.
2026-05-28 15:26:31 -07:00
J Logan 445c90f927 Fix potential integer math crash on PublishPort. (#1612)
- Closes #1610.
- Discovered, and originally filed as a security advisory, by:
PresidentL <131139636+liyander@users.noreply.github.com>.
- `PublishPort` currently can store invalid combinations of starting
port and range that can overflow UInt16 values when summed, crashing the
process.
- Updates `PublishPort` to validate inputs on initialization.
2026-05-28 11:12:04 -07:00
Kathryn Baldauf 046884df37 Use ManagedResource for volumes in CLI commands (#1607)
## Type of Change
- [x] New feature  

## Motivation and Context
Related to https://github.com/apple/container/issues/1404.

This PR adds the initial work to have volume resources conform to
ManagedResource, in alignment with other resources such as networks (see
[here](https://github.com/apple/container/pull/1421)). Further work is
necessary to move the use of `VolumeResource` down to the APIServer (in
the VolumesService) and in the volume client. Volumes do not currently
have any plugin or runtime state, so that information is not included in
the `VolumeResource`, but could be added later if needed.

## Testing
- [x] Tested locally

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-05-28 09:33:21 -07:00
J Logan d43b58ec73 Align JSON output with shape for container resource. (#1611)
- Part of #1404.
- Use `configuration` for configuration properties, `state` for current
state label, `status` for status properties.
2026-05-28 09:07:01 -07:00
Kathryn Baldauf d2aa01ec05 Add ability to configure integration test list at command line (#1608)
## Type of Change
- [x] New feature  

## Motivation and Context
When developing, there are times when I want to run a specific set of
CLI tests. This PR allows users to set what integration tests they want
to run by setting the makefile variable `INTEGRATION_TEST_SUITES`.

Example usage: 
```
% INTEGRATION_TEST_SUITES="TestCLIVolumes TestCLIAnonymousVolumes"  make all integration
```

## Testing
- [x] Tested locally

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-05-27 17:36:24 -07:00
NONE 685966d026 cli: resolve subcommand path in container help (#1587)
- Fixes #1509. The CLI's own help text tells users to
  run `container help <subcommand>`, but every form
  of that results in an error.
- Added a captured subcommand path, walked 
  Application`'s `subcommands` + `groupedSubcommands`
  tree (matching `commandName` and `aliases`), and
  printed `Application.helpMessage(for:)` for the resolved
  target. Empty path keeps existing plugin-aware top-level
  help; unknown path throws `ValidationError`.
2026-05-27 10:54:49 -07:00
Kathryn Baldauf 8261a27ed0 Add shmSize to management flag's init (#1603)
## Type of Change
- [x] Bug fix

## Motivation and Context
Ensure all fields are initialized in the management flags' init
function. Without this change, if someone calls init() on this set of
flags, they will get an error like

```
Can't read a value from a parsable argument definition.

This error indicates that a property declared with an `@Argument`,
`@Option`, `@Flag`, or `@OptionGroup` property wrapper was neither
initialized to a value nor decoded from command-line arguments.

To get a valid value, either call one of the static parsing methods
(`parse`, `parseAsRoot`, or `main`) or define an initializer that
initializes _every_ property of your parsable type.
```

## Testing
- [x] Tested locally

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-05-26 17:51:10 -07:00
Kathryn Baldauf 25ab5934e4 Support use of custom app root with system config in CLI commands (#1600)
## Type of Change
- [x] Bug fix

## Motivation and Context
Many CLI commands need to reference the system configurations for
`container`. Previously, CLI commands would try to load the system
configurations from the default application root location, regardless of
if `container` had been started with a custom application root location.
This PR fixes that issue by having each CLI command ping the APIServer's
health check service to get the correct app root path.

Closes https://github.com/apple/container/issues/1576

## Testing
- [x] Tested locally

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-05-26 14:33:53 -07:00
J Logan ca3a4d6670 Use FilePath for app, install, and log roots. (#1558)
- Closes #1557.
- Replaces `executableURL` utility function for getting app executable
path with `executablePath`.
- Adds `FilePath.resolvingSymlinks()` extension.
- Also converts for FilePath for types in `ContainerVersion` target.
2026-05-26 13:58:55 -07:00
Dmitry Kovba 277c96cbea Bump containerization to 0.33.1 (#1601) 2026-05-26 12:56:44 -07:00
J Logan caff1e9b42 Improve readability of progress bar width computation. (#1584)
- Refines bugfix from #1547, no functional changes.
2026-05-22 13:03:09 -07:00
J Logan 985248cf23 Refine custom init how-to and BUILDING documentation. (#1586)
- Closes #1540.
- Use a published vminit image in the custom init example.
- Refine the integration test example in BUILDING.md to build in an
isolated app-root directory.

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

## Motivation and Context
We don't make `latest` tags for vminit images, so the example would
fail.

## Testing
- [ ] Tested locally
- [ ] Added/updated tests
- [x] Added/updated docs
2026-05-22 09:01:00 -07:00
J Logan 04220b12d0 Adds vertical space between groups in help. (#1585)
- Closes #1513.
2026-05-22 08:56:25 -07:00
Erwan Legrand 831a6bfe1c fix: clamp ProgressBar barLength to non-negative value to avoid crash (#1525)
- Closes #1547.
- A negative progress value (e.g. from a race in progress events) would
produce a negative barLength and crash inside String(repeating:count:).
Wrap the computed length in max(0, ...) and add a regression test that
calls set(size: -10) and exercises draw(state:detail:).
2026-05-21 19:11:28 -07:00
Danny Canter de780c1478 cli: Add support for --stop-signal (#1462)
- Closes #1581.
- This adds stop signal support to the cli. The priority is:
  1. If an explicit stop signal is passed on the cli use this.
  2. If not, check if there is a stop signal in the image config.
  3. Finally, use the default (TERM).
2026-05-21 17:55:48 -07:00
J Logan 3d291ff865 Add notes regarding --log-root to the command reference. (#1582)
- Closes #1529.
2026-05-21 17:19:44 -07:00
jwhur df35f79ae0 Update container copy to use FilePath (#1580)
- Replace `URL` with `FilePath` in `container copy` (#1557).
  In addition, make `copyIn`/`copyOut` API to use `String` for path as we
  need to preserve the trailing slash to the `LinuxContainer.copy`---i.e.,
  this trailing slash is used in `LinuxContainer.copy` to determine copy
  behavior.
2026-05-20 13:50:08 -07:00
jwhur 145867e6e2 Add more tests for container copy (#1579) 2026-05-20 13:04:49 -07:00
AJ Emory 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 Kang 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 Kang 38075f3275 [images]: convert save to use FilePath (#1574)
- Closes #1573.
2026-05-20 10:43:12 -07:00