See discussion below for example. For multiple network interfaces in a
single container we'll want to integrate against a containerization that
includes apple/containerization#156.
The change bumps the containerization dependency to 0.2.0 and addresses
the breaking API changes.
```console
% container network
OVERVIEW: Manage container networks
USAGE: container network <subcommand>
OPTIONS:
--version Show the version.
-h, --help Show help information.
SUBCOMMANDS:
create Create a new network
delete, rm Delete one or more networks
list, ls List networks
inspect Display information about one or more networks
See 'container help network <subcommand>' for detailed help.
```
Closes https://github.com/apple/container/issues/80
Adds the following help message if you try to run `container` against a
host that hasn't started the container system:
```
❯ /usr/local/bin/container list
Error: internalError: "failed to list containers" (cause: "interrupted: "Connection invalid: ensure container system has been started with `container system start`"")
❯ /usr/local/bin/container run -it --rm docker.io/alpine
Error: interrupted: "Connection invalid: ensure container system has been started with `container system start`"
```
This PR resolves a race condition when removing a container immediately
after stopping it, caused by the `stop` command returning before the
container fully transitions to the stopped state (#130).
**Changes:**
- Enhanced `TestCLIRmRace.swift` with robust test logic and helper
methods (`containerExists`, `safeRemove`).
- Improved error handling to distinguish race conditions from successful
removals.
- Added exponential backoff retry logic for cleanup operations.
- Updated `CLITest.swift` with missing `doRemove` method.
- Fixed `BuilderStart.swift` to handle `.stopping` case.
- Improved error messages with container ID for better debugging.
**Testing:**
- ✅ All tests pass (`make test`, `make integration`).
- ✅ Verified on macOS 26.
- ✅ Race condition test validates success and failure scenarios.
- ✅ Code formatted (`make fmt`).
Hopefully, this will pass the integration tests on GitHub.
Signed-off-by: ramsyana <47033578+ramsyana@users.noreply.github.com>
Implements a way for the CLI to wait until the IO streams from the
SandboxService have been drained before closing them.
Follows the same pattern as
https://github.com/apple/containerization/pull/110
This change also performs some cleanup in the
`SandboxService.startProcess` method - splitting the code paths to
handle the init process and an exec'd process into two different private
methods to make easier reading
---------
Signed-off-by: Aditya Ramani <a_ramani@apple.com>
This PR adds a warning that the performance may be degraded when running
a debug build.
Debug build:
```
% bin/container run -it --rm alpine:latest date
Warning! Running debug build. Performance may be degraded.
Fri Jun 13 18:10:35 PDT 2025
```
Release build:
```
% bin/container run -it --rm alpine:latest date
Fri Jun 13 18:10:35 PDT 2025
```
This PR resolves the problem of dropped progress updates and ensures the
accuracy of the information provided in the progress bar. Additionally,
it adds the displaying of the finished state to the progress bar.
Requires merging and tagging
https://github.com/apple/containerization/pull/91.
This change consolidates the UserDefaults service name
`com.apple.container.defaults` to a single constant under the extension
file and also renamed the extension file.
Signed-off-by: Yibo Zhuang <yibzhuang@gmail.com>
this PR defines a variable, `decoder`, which represents the
`JSONDecoder` class, rather than doing it in the for loop in `load()`
Signed-off-by: Elijah Wright <git@elijahs.space>
This PR updates the protos to match the recent changes in
https://github.com/apple/container-builder-shim/pull/15.
This PR additionally adds the builder shim version as a variable in
Package.swift. This allows us to be consistent with the builder tag used
for the builder shim image and when building protobuf files.
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
Closes https://github.com/apple/container/issues/126
This PR additionally removes the ability to set
`disable-progress-updates` for `container create` calls while we
investigate why output get jumbled there.
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
Container services can be started and stopped using the `system start`
and `system stop` commands. But there is no straightforward way for
users to check if the services were already started.
This PR adds a new `system status` command that shows wether the
container services are running or not.
The command only checks the status of the apiserver for now, but it
could be expanded in the future to show more details.
Fixes#117.
`BuildFSSync.walk` relied on an implementation detail to skip traversing
the path ".", relative to the build context dir.
Specifically, it assumed that:
- `URL.parentOf()` would return false when the parent argument was
relative.
- `URL.path(percentEncoded: false)` would preserve the relativity of an
input path.
These assumptions held on earlier macOS releases, so the context
directory silently remained untouched.
In some versions of macOS , `URL.path(percentEncoded: false)` always
returns an absolute path, regardless of how the URL was created. Because
of this change, `URL.parentOf()` now returns true for ".", and
BuildFSSync.walk begins descending into the context directory—something
it was never meant to do.
This solution:
- Remove the hidden dependency on `URL.parentOf()` for context‑directory
detection.
- Add an explicit check for "." inside BuildFSSync.walk and bail out
early.
Replace fragile calls to `URL.path(percentEncoded: false`) with the
stable, documented `URL.relativePath`, which preserves relativity when
the original path was relative.
Replaces the `--install-dependencies` flag with the
`(enable/disable)-kernel-install` flag. If the flag is not passed - the
default behavior is prompting the user for a response.
Also adds a make target `install-kernel`
```
➜ bin/container system start
Verifying apiserver is running...
Installing base container filesystem...
No default kernel configured.
Install the recommended default kernel from [https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz]? [Y/n]: n
Please use the `container system kernel set --recommended` command to configure the default kernel
➜ bin/container system start --disable-kernel-install
Verifying apiserver is running...
➜ bin/container system start --enable-kernel-install
Verifying apiserver is running...
Installing kernel...
➜ bin/container system start --help
USAGE: container system start ... [--enable-kernel-install] [--disable-kernel-install]
...
--enable-kernel-install/--disable-kernel-install
Specify if the default kernel should be installed or not.
```
---------
Signed-off-by: Aditya Ramani <a_ramani@apple.com>
When a container that was writing stdout/stderr to its dedicated
container log file was stopped and started, there was a ~20 second - 1
minute delay from when the init process was restarted and when the
output of the process was written to the log file. This also meant there
was a delay when streaming those logs using `container logs -f`. The
logs from that delay period were lost.
This change forces the container log file to update state after a
container restart which fixes the delays to the container log file. And
the` container logs -f` stream resets its position in the file on a
container restart as well.
---------
Co-authored-by: Arnav Reddy <areddy23@apple.com>
This change updates the UX when we install required dependencies at
first launch
### Fresh install - respond `y` to prompt
```
➜ bin/container system start
Verifying apiserver is running...
Installing base container filesystem...
No default kernel configured.
Install the recommended default kernel from [https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz]? [Y/n]: y
Installing kernel...
```
### Fresh install - respond `n` to prompt and then run the provided
command
```
➜ bin/container system start
Verifying apiserver is running...
Installing base container filesystem...
No default kernel configured.
Install the recommended default kernel from [https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz]? [Y/n]: n
Please use the `container system kernel set --recommended` command to configure the default kernel
➜ bin/container system kernel set --recommended
Installing the recommended kernel from https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz...
```
### Fresh install - respond `n` to prompt and then run a container
```
➜ bin/container system start
Verifying apiserver is running...
Installing base container filesystem...
No default kernel configured.
Install the recommended default kernel from [https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz]? [Y/n]: n
Please use the `container system kernel set --recommended` command to configure the default kernel
➜ bin/container run alpine uname
Error: notFound: "Default kernel not configured for architecture arm64. Please use the `container system kernel set` command to configure it
```
---------
Signed-off-by: Aditya Ramani <a_ramani@apple.com>
This PR resolves a race with `\u{001B}[2K`, but not with `\r`, which
will be addressed in a separate PR by moving progress updates to
`stdout`. Please test it in a small window in your terminal application
on the `users/a_ramani/install-ux` branch using commands:
```
bin/container system stop
make cleancontent
bin/container system start
```
You should see the prompt:
> Install the recommended default kernel from
[https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz]?
[Y/n]:
The output now looks like the following
#### When build against a tagged HEAD in `RELEASE` mode
```
container --version
container CLI version 0.0.2 (build: release, commit: ed4a4cb)
```
Its a bit weird to have to pass `--http` when pulling / pushing images
if we are trying to do so from a local registry
This PR adds a `RequestScheme` enum type which tries to detect if the
connection to the registry should be over http or https. This auto
detection is the default behavior and can be overridden by passing the
`--scheme http/https` flag to the `run` ,`pull`, `push` `login` and
`registry default` command
The auto detection works by looking at the hostname / IP. HTTP is used
in the following cases
- If the hostname starts with `localhost` or is `127.x.x.x`
- if the host looks like an IP from the private address space
- If the host ends with the current default dns domain name
Also in this PR:
- Removing some used CLI flag groups and TODOs
- Better error messages when registry credentials are not found for a
host
Signed-off-by: Aditya Ramani <a_ramani@apple.com>