414 Commits

Author SHA1 Message Date
Danny Canter 3e49dcef4e Add in missing rlimits (#1140)
Containerization didn't have these defined until a recent tag.
0.9.0
2026-02-03 00:45:01 -08:00
J Logan c4c2e8515b Upgrade kernel to Kata 3.26.0. (#1134)
- Upgrade to containerization 0.24.5 to pick up zstd decompression
enhancement.
- Closes #767.
- Closes #988.
- Closes #1132.
- Requires apple/containerization#508.
2026-02-03 00:27:09 -08:00
William Laverty 5c8633703e Add explanatory message before admin password prompt in uninstall script (#1118)
- Added message: "This script requires an administrator password to
remove the application files from system directories."
- Fixes #1111
2026-02-02 13:57:59 -08:00
Danny Canter 7da25e142e Deps: Bump Containerization to 0.24.0 (#1127)
Brings in some rlimit bumps/adjustments
2026-02-02 13:35:02 -08:00
Danny Canter 7dfe27d825 CLI: Add support for rlimits (#1129)
Closes #1097.
2026-02-02 13:30:19 -08:00
J Logan b3b5c3e609 Use labels instead of id to discriminate the builtin network. (#1123)
- Closes #1122.
- Adds placeholder ManagedResource and unit tests. Nothing is using
these yet.
- Adds system-defined resource labels for owning plugin and resource
role. The system discriminates the builtin network using role "builtin".
- Adds builtin role when creating builtin network at startup, and
ensures that a preexisting network with ID "default" gets updated with
the role label.
- Replace all network ID checks for "default" with the builtin role
check.
- Adds "builder" role to builder VM.

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

## Motivation and Context
Role and owner labels should make cross-cutting resource policy easier
to implement.

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [ ] Added/updated docs
2026-02-02 12:24:27 -08:00
w-ferg 1dae1cdd56 Fix pfctl executable path in PacketFilter DNS reload (#1128)
## Summary

The `reload()` method in `PacketFilter.swift` references
`/sbin/reloadProcess` (the local variable name) instead of
`/sbin/pfctl`. This causes all DNS create and delete operations to fail:

```
Error: internalError: "pfctl reload exec failed: "Error Domain=NSCocoaErrorDomain Code=4 "The file "reloadProcess" doesn't exist.""
```

## Fix

One-line change: `/sbin/reloadProcess` → `/sbin/pfctl`

## Testing

Verified on macOS 26 (Tahoe) with Apple Silicon:
- `sudo container system dns create test.sdc.internal --localhost
203.0.113.1` succeeds without error
- Container can resolve and reach host services through the DNS redirect
2026-02-01 15:14:41 -08:00
Ronit Sabhaya 113a6ec5ba Fix file descriptor leak in DirectoryWatcher (#1104)
- `DirectoryWatcher` opens file descriptors for monitoring
  directories but never closes them, causing a file descriptor
  leak.
- Adds `setCancelHandler` to properly close file descriptors
  when the `DispatchSource` is cancelled.

Signed-off-by: Ronit Sabhaya <ronitsabhaya75@gmail.com>
2026-01-30 19:54:57 -08:00
Saehej Kang 72f04b6f14 [docs]: update steps on building with containerization project (#1116)
- Closes #1095 
- Just added a few more details about how to build with the local
  `containerization` dependency.
2026-01-30 19:10:03 -08:00
Raj 3a0ad58df2 Add resource.role label to builder container (#1120)
Add resource.role label to builder container
2026-01-30 16:17:43 -08:00
J Logan 1c01d0c411 Update to kata 3.20.0 kernel. (#1114)
- Closes #1113.
- This is the newest we can do until we address #767.
- Slight change to PacketFilter error handling so unit tests work more
reliably.
- Try making CLINetworkTests serialized to see if parallel execution is
causing flakes.
2026-01-30 11:07:49 -08:00
Danny Canter 3f2060e460 DirectoryWatcher: Small adjustments (#1112)
- Have the handler throw
- Log the failure at error level
2026-01-29 18:25:48 -08:00
Danny Canter 0a7fb07757 Set mtu to old Containerization default (#1110)
The old mtu default in containerization was 1280 to account for some
alpine/musl images that have issues with
1500. This changed in the last couple tags to be modifiable, but the new
default is the standard 1500. Ideally we eventually allow supplying the
mtu to be used when you create a network (or possibly a container
creation setting), but for now just default in here back to what CZ used
to use.
2026-01-29 14:21:12 -08:00
Aditya Ramani 0bceb23472 Bump to use containerization 0.23.2 (#1106)
Updating the package dependency on apple/containerization to pick up bug fixes

Signed-off-by: Aditya Ramani <a_ramani@apple.com>
Co-authored-by: J Logan <john_logan@apple.com>
2026-01-28 19:08:42 -08:00
jwhur d762fe55a2 Launch a service with waitForDebugger if specified (#1101)
This PR enables launching a service with `waitForDebugger` flag if the
service label matches a given env variable `CONTAINER_DEBUG`.
2026-01-28 18:22:33 -08:00
dependabot[bot] 4f93e3e098 ci: bump actions/checkout from 6.0.1 to 6.0.2 in the github-actions group (#1100)
- Updates `actions/checkout` from 6.0.1 to 6.0.2

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-28 18:21:08 -08:00
jwhur 371db6d244 Fix testExecOnExitingContainer (#1107)
Check the container remains only, not its status as the status might not
have been updated at the time checking.
2026-01-28 17:17:08 -08:00
J Logan d8722708ec Removes ArgumentParser import from NetworkMode. (#1102)
- ContainerResources shouldn't need to know anything about CLI stuff.
- Move ExpressibleByArgument protocol conformance to an extension in the
package where it's needed.
2026-01-28 09:04:58 -08:00
Saehej Kang 3abf81f69e [image-list]: Add full size field to json output (#1098)
- Refer to #862
- Updated `SIZE` field to `FULL SIZE`, as it seemed more appropriate so
it does not get mixed up with the `descriptor size` field
- Closes #860
2026-01-27 20:00:43 -08:00
ChengHao Yang 24cbed56b3 Implement container prune (#904)
- Fixed #892.
- By contrast with `rm`, `prune` should display
  the amount of reclaimed storage, so added code
  to retrieve it.

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2026-01-27 14:55:49 -08:00
jwhur a57527e4b0 Refactor container lifecycle functions to perform scoped rollback on failure (#1080)
- Closes #977.
- Closes #1058.
- Prevents unexpected removal of containers on
  bootstrapping and starting failures, by reorganizing
  error handling for container `run`, `start`, and
  `exec` so that error handling only unwinds that
  which was done in the current scope.
- Relies on apple/containerization#495.
2026-01-27 11:15:22 -08:00
c 6244129dc3 Fix grammar in BUILDING.md (#984)
- Fixes a grammar error in the local Containerization development
instructions.
2026-01-26 20:30:45 -08:00
jwhur 9d4cdede8c Isolated network (#1079)
- Closes #1037.
- Adds a `--mode` flag that has `nat` and `hostOnly` options.
  The host-only option selects the vmnet host-only mode,
  where containers attached to the network can reach each
  other and the host, but not external systems.
2026-01-26 19:35:41 -08:00
J Logan 033c999f5c Make TerminalProgress a library. (#1093)
- Closes #1092.
- Allows 3rd party CLI plugins to use the progress indicator.
2026-01-26 14:07:00 -08:00
ChengHao Yang b371aee610 Feat: container image delete force option (#1096)
- Fixed #1087

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2026-01-26 13:07:05 -08:00
jwhur ed1185d489 Container-to-host networking. (#1078)
- Closes #346.
- This PR enables connecting host's localhost ports from
  containers.
- It adds an option `--localhost <localhost>` to DNS
  create command, after which the packets heading
  ip address in container are redirected to localhost in
  host machine. Packet filter rule is added and deleted
  along with the creation and deletion of localhost domain.
2026-01-23 17:59:28 -08:00
Patrick Linnane 14c279fcd2 Add option to stop services in all launchd domains (#1077)
- Services started from Terminal run in the `gui/$uid`
  launchd domain. When `ensure-container-stopped.sh`
  runs from a different context, `launchctl managername`
  may return a different domain, causing the script to
  check the wrong domain and miss running services.
  I noticed this after upgrading `container` via Homebrew.
- Introduces a getopt option `-a` that allows booting out all
  domains explicitly. Also adds `-h` for a usage message.

Signed-off-by: Patrick Linnane <patrick@linnane.io>
2026-01-23 17:56:35 -08:00
Stanislav Antonichev 751c1fc05c Add --dns support to build command for custom DNS resolution (#1067)
This change adds --dns parameter support to the build command, matching
the existing functionality in the run command. This allows users to
specify custom DNS nameservers (like Google DNS 8.8.8.8) when building
container images, which is essential when the host machine uses a local
DNS resolver (e.g., 127.0.0.2) that doesn't work inside containers.

Changes:
- Added --dns option to BuildCommand to accept DNS nameserver IP
addresses
- Modified build logic to detect DNS configuration changes and recreate
the builder container when DNS settings differ
- Passed DNS configuration to BuilderStart.start() method
- Updated builder container creation to use specified DNS nameservers or
fall back to network gateway

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

## Motivation and Context
This change adds --dns parameter support to the build command, matching
the existing functionality in the run command. This allows users to
specify custom DNS nameservers (like Google DNS 8.8.8.8) when building
container images, which is essential when the host machine uses a local
DNS resolver (e.g., 127.0.0.2) that doesn't work inside containers.

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

---------

Co-authored-by: J Logan <sgtbakerrahulnet@yahoo.com>
2026-01-23 13:01:26 -08:00
J Logan 55f211251c Place image store data correctly for app-root path. (#1085)
- Closes #1084.
2026-01-23 11:35:10 -08:00
ChengHao Yang 5746ec35b3 Fix: prevent delete default network (#1083)
- Fixed #1073
- Move the conditional check to the front; there's no need
  to check for a default network after filtering.

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2026-01-23 11:32:59 -08:00
Saehej Kang c42108d3df [image-inspect]: stdout/stderr and logging refactor (#1044)
- Relates to #642.
- Each image carries it own error message (allows for different error
types per image)
- Stdout/stderr support
- Use of the new `StderrLogHandler`
2026-01-21 22:00:03 -08:00
J Logan a18df81eb0 Select macOS 26 CI runners. (#1074)
- Runner fleet is on 26.3 now.
- Integration tests started flaking and it appears that we've been misconfiguring/not configuring proxy variables where we needed to be and it finally caught up with us. Workflow now adds appropriate exclusions for host-to-container and container-to-container network requests so they aren't all rammed through the proxy.
0.8.0
2026-01-21 18:25:39 -08:00
J Logan 2b18fc5870 Use StderrLogHandler for rich logging features. (#1066)
- Facilitates #507, #642.
- Plumb logger with logger option access into every command.
- StderrLogHandler allows logging to be enhanced for ANSI color mode for
log levels, JSONL log output, replacing `--debug` with `--level level`.
- Global logger is now just an Application.swift fileprivate only used
for initial args processing.
- Log with timestamp at debug and trace level.
- Metadata output is crude at present; we can refine this in a
follow-up.
2026-01-20 14:38:29 -08:00
J Logan a5607a8cf6 Update to containerization 0.21.1. (#1064)
- Picks up apple/containerization#478
2026-01-20 14:25:07 -08:00
Kathryn Baldauf 94d5529fc4 Use configuration subnet and fallback to default subnet in allocation only plugin (#1057)
## Type of Change
- [x] Bug fix

## Motivation and Context
This PR changes the behavior of the Allocation Only vmnet network plugin
to use the default subnet in the fallback case if no subnet was
specified in the network configuration. This matches the behavior of
`ReservedVmnetNetwork`.

## Testing
- [x] Tested locally
2026-01-19 19:23:06 -08:00
Kathryn Baldauf 9032d73d07 Change behavior of the default arguments in the plugin config (#1063)
## Type of Change
- [x] New feature  
- [x] Breaking change

## Motivation and Context
This PR changes the behavior of the `defaultArguments` field in the
service plugin config. Previously, `defaultArguments` was functioning as
a way to indicate how to start a plugin in the event that the plugin is
loaded at boot (such as for the `container-core-images plugin`).
However, we now follow a convention where all plugins have a "start"
command that is used when launching the plugin, so this
`defaultArguments` field wasn't really providing much. Instead, there
are use cases where we may want to set default values to pass to a
plugin. This PR repurposes the `defaultArguments` field for those use
cases.

As an example use case, there are scenarios where someone may want to
use the AllocationOnlyVmnetNetwork even when running on macOS 26+. This
PR adds the ability to pass in a command line option to the vmnet
network plugin to specify that request. Combined with the
`defaultArguments` plugin config change, a user may choose to set that
field to ["--variant", "allocationOnly"] in the
`container-network-vmnet-config.json` to use AllocationOnlyVmnetNetwork
by default for all networks.

## Testing
- [x] Tested locally
2026-01-19 19:22:55 -08:00
jwhur 69445b91b3 Throw error when starting a container with invalid virtiofs source (#1051)
Run = Create + Start

1) Mount source points to a valid directory
- Run and Create + Start both correctly create the container with mount.

2) Mount source points to a file
   - Run fails bootstrapping the container, thus container not created.
- Create creates the container, but Start fails bootstrapping, removing
the container. (Thus, both are the same.)

3) Mount source deleted or replaced to file after container created
   - Start throw errors but do not delete the container.
2026-01-19 13:09:34 -08:00
Danny Canter 08f48d9ab9 ContainerSvc: Handle unexpected sandbox svc exits (#1065)
Closes https://github.com/apple/container/issues/1050

If the sandbox svc exits out of band of the usual stop (or regular exit)
case the container svc's state is not properly updated for the
container. This was due to the cleanup steps involving trying to send
the shutdown rpc which cannot succeed as the sandbox svc does not exist
to service it.

To handle this, let's treat shutdown not returning successfully as
non-fatal (as this is mostly best effort), log an error and continue the
state cleanup.
2026-01-16 21:48:58 -08:00
Amir Alperin b928e3ff1d fix: performance warning should not output ANSI codes if stderr redirected (#1059) 2026-01-16 21:43:48 -08:00
J Logan 744e7f7c7a Update for containerization 0.21.0. (#1056)
- Update image load and build to handle rejected paths during tar
extraction. For the image load command there is now a `--force` function
that fails extractions with rejected paths when false, and just warns
about the rejected paths when true.
- Update `container stats` for statistics API properties now all being
optional.

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

## Motivation and Context
See above

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs
2026-01-16 16:26:13 -08:00
J Logan b1577d8d07 Adds opt-in pre-commit hook for format and header checks. (#1062)
- Closes #639.
- Adds swift format configuration that removes lint checks so we can use
`swift lint` to perform format-only tests.
- Adds `check` target that invokes format and header checks.
- Adds pre-commit script that runs `make check`.
- Adds `pre-commit` target that installs the check script as a
pre-commit hook.

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

## Motivation and Context
Avoids wasting time and commit rewrites.

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [x] Added/updated docs
2026-01-16 15:50:47 -08:00
J Logan 3cf2c6ad8d Fix unstable integration tests. (#1060)
- TestCLIRunCommand now run so many tests concurrently that the API
server gets swamped and tests randomly time out.
- The parallelism options on `swift test` only work for XCTest, not
swift-testing.
- Work around this while retaining some parallelism (good for stress
testing) by breaking the tests into two suites.
2026-01-16 13:41:32 -08:00
Manu Schiller 8897fcc4a0 fix: use pax instead of tar for pkg payload extraction (#1038)
- It is common to have `gnu-tar` alongside other GNU tools
  installed and aliased for compatibility reasons. However, this
  breaks the current make build.
- Use BSD-only binaries (no GNU equivalents that are
  commonly aliased), making the Makefile more portable.
2026-01-13 19:39:08 -08:00
Ronit Sabhaya dbec1db03e Add support for aarch64 architecture alias (#1040)
- Adds `aarch64` as an alias for `arm64` in the `Arch` enum. This
  addresses the maintainer's request to support this common architecture
  name, ensuring consistency with `x86_64` normalization and preventing
  failures for users expecting `aarch64` support.
2026-01-12 18:34:25 -08:00
jwhur 837aa5eb83 Fix the FS error when using Virtualization (#1041)
- Fixes #614.
- Use VZ cached mode instead of auto.

Signed-off-by: jwhur <jaewon_hur@apple.com>
2026-01-12 14:36:10 -08:00
박성근 e465b109b2 Fix relative path resolution in entrypoint (#987)
- Fixes #962.
- Adds test to exercise apple/containerization#473.
- Updates containerization to 0.20.1.

Signed-off-by: ParkSeongGeun <phd0801@naver.com>
2026-01-12 10:30:51 -08:00
Ronit Sabhaya aa7792807c Fix: Support x86_64 architecture alias to prevent silent pull failure… (#1036)
- Adds architecture name normalization to accept
  `x86_64` and `x86-64` as aliases for `amd64`.
2026-01-12 10:04:46 -08:00
Amir Alperin dc4682be74 fix: extract hostname from FQDN (#1011) (#1017)
- Set the container hostname to the first DNS
  label derived from the container id, strip everything
  after the first dot.
- Fixes #1011.
2026-01-09 11:10:53 -08:00
Ronit Sabhaya 4af1cc01c4 fix: improve error message when binding to privileged ports (fixes #978) (#1031)
- The container fails to start with a generic "permission denied"
  error when attempting to publish privileged ports (ports below
  1024) without root privileges. This provides a confusing user
  experience as the error doesn't explain why permission was
  denied.
2026-01-08 19:27:43 -08:00
J Logan 21facf00a8 Add instructions for using locally built init filesystem. (#1032)
- Closes #1030.
2026-01-08 17:02:22 -08:00