Commit Graph

47 Commits

Author SHA1 Message Date
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
J Logan 3d291ff865 Add notes regarding --log-root to the command reference. (#1582)
- Closes #1529.
2026-05-21 17:19:44 -07:00
Simone Panico 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
Noah Thornton 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
ChengHao Yang 44754dacaf Add container system version with format yaml (#1353)
Fixed #1156. Introduces yaml formatting.

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2026-04-22 14:26:20 -07:00
J Logan 86611f588b Adds journal option to container volume create. (#1412)
- Closes #1411.
- Default behavior doesn't change today - with no `journal` option, no
journal gets created.
2026-04-22 09:34:24 -07:00
Nikunj Thakur 1c37384831 Add Color Progress Output Mode (#1384)
- Adds a color progress output mode (`--progress color`)
  that renders ANSI-colored progress output with visual
  differentiation between progress states.
- Like `ansi` mode, this feature requires a TTY.
- Closes #1366
2026-04-10 09:19:16 -07:00
Danny Canter a557ce80a5 Add capabilities support (#1383)
Closes #1352

Containerization has had support for a bit, it was just never brought
over here. It's exposed on the CLI via the classic `--cap-add` and
`--cap-drop` UX.
2026-04-07 17:09:56 -07:00
Nikunj Thakur 745134540e Add Plain Progress Output Mode (#1367)
- Adds a `plain` progress output mode (`--progress plain`)
  that outputs newline-separated progress lines without
  ANSI escape sequences. This is useful for CI environments,
  piped output, and non-TTY contexts where ANSI cursor
  control is not supported. Unlike `--progress ansi`, plain
  mode works even when stderr is not a TTY.
- Closes #1365
- Related: #641, #808
2026-04-01 18:24:39 -07:00
Ryan Goulden a00ec5c1f7 Add support for build secrets (#1300)
docker-compatible `--secret id=key,...` arg for `container build`, that
works with Dockerfiles with `RUN --mount=type=secret`

Requires https://github.com/apple/container-builder-shim/pull/69

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

## Motivation and Context
Adds support for Dockerfiles that use build secrets (e.g. `RUN
--mount=type=secret ...`)

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs
2026-03-16 17:04:24 -07:00
ChengHao Yang 79ef8469bc Refactor: container export a tar archive (#1303)
Fixed #1265.

## Type of Change

- [ ] Bug fix
- [ ] New feature  
- [x] Breaking change
- [x] Documentation update

## Motivation and Context

Fixed #1265

## Testing

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

---------

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2026-03-11 12:43:13 -07:00
Danny Canter 899081d094 cli: Add --init to run/create (#1244)
Closes #1225

Add a flag to signify that we'd like to run a minimal init process that
can reap zombie processes. The actual support for this is in the
Containerization library so the plumbing here is very simple.
2026-02-23 16:02:38 -08:00
J Logan a409c0f7dd Add --format option for system status. (#1237)
- Closes #1236.
- As with other resources, default to tabular output, with `--format
json` alternative.
- Also changes common workflow to collect logs even when test step times
out.
2026-02-20 15:18:29 -08:00
J Logan d29947121f CI observability enhancements. (#1193)
- Adds a a `--log-root` option to `swift system start`, propagating the
value as `CONTAINER_LOG_ROOT` to services for logging to files instead
of the OS log facility. This is not a "production" capability as it
neither merges nor rotates logs.
- Currently we don't collect logs on CI builds, and we don't have
permission to run the `log` command there. The PR adds `--log-root` to
the CI test phase, archives the results, and uploads the archive as an
artifact.
- Use FilePath from swift-system for the log root. Foundation URL is a
bit of a footgun for filesystem paths, so unless we identify a
showstopper, we should incrementally transition to this type everywhere
except where we really need network URLs.
- Output the hostname of the CI runner at the start of the test phase so
we can identify runner-specific issues where they exist.
- Fix formatting for log messages with multiple metadata items, and fix
unstructured messages on instances that weren't found using `grep -r
'log\.' Sources`.
- Adds command reference documentation for `--log-root`.
2026-02-19 17:47:41 -08:00
ChengHao Yang c9f81ca332 Feat: add container registry list (#1119)
- Requires apple/containerization#502
- Closes #1088

---------

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2026-02-10 12:26:33 -08:00
Manu Schiller cf9b335aa1 feat: add --init-image flag for specifying custom init filesystem images per VM (#937)
- Users can now specify an alternate image to use
  with the `container run ---init-image` flag.
2026-02-09 18:11:27 -08:00
Amir Alperin 474906daf9 feat: Add runtime flag to container create and run commands (#1049) (#1109)
## Type of Change
- [ ] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
Fixes #1049 
-  Add --runtime option for Flags.Management
-  Apply runtime handler in containerConfigFromFlags
-  Update command-reference.md doc

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

Co-authored-by: J Logan <john_logan@apple.com>
2026-02-06 13:38:19 -08:00
Saehej Kang 21dabb74fa [build-command]: Add --pull option for fetching latest image (#844)
- Closes #733.
2026-02-05 00:13:36 -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
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
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 5064b0ffd5 Adds network IPv6 configuration. (#975)
- Part of work for #460.
- Enable set/get of IPv6 network prefix in ReservedVmnetNetwork.
- Show IPv6 prefix in `network list` full output.
- Option for setting IPv6 prefix when creating a network.
- System property for default IPv6 prefix.

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

## Motivation and Context
See #460.

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [x] Added/updated docs
2025-12-22 10:16:14 -08:00
Saehej Kang 9f4efe0c4c [networks]: add prune command (#914)
- Closes #893
2025-12-17 00:30:33 -08:00
wangxiaolei a2901e0517 feat: implement version sub command (#911)
- closes #383
- implement version sub command, give more info

---------

Co-authored-by: fatelei <fatelei@fateleis-MacBook-Pro.local>
2025-12-09 23:04:40 -03:00
Saehej Kang a5fd902893 [docs]: move callout regarding documentation revisions (#921)
- Closes #920
- Makes note about main branch documentation more discoverable.
2025-12-02 10:12:42 -03:00
Saehej Kang f0eb13176c [docs]: add volume prune to command reference (#910)
## Type of Change
- [ ] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [x] Documentation update

## Motivation and Context

Looks like this got accidentally deleted in #805

## Testing
- [ ] Tested locally
- [ ] Added/updated tests
- [x] Added/updated docs
2025-11-21 15:33:50 -08:00
Raj 1c0e9888f3 Fix container image prune to actually remove images, add -a flag support, and bump cz to 0.15.0 (#909)
- Fixes #901.

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

## Motivation and Context
Previously `container image prune` called `ImageStore.prune()` (renamed
to `cleanupOrphanedBlobs()` in cz 0.15.0) which only removed orphaned
content blobs and never actually removed images.

This PR fixes that behavior so `container image prune` removes dangling
images by default, and with `-a` removes all unused images, not just
dangling ones.

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
2025-11-21 10:55:00 -08:00
Raj d327a50219 Add container system df command for disk usage reporting (#902)
- Closes #884. 

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

## Motivation and Context
This PR implements the `container system df` command to display disk
usage statistics for images, containers, and volumes, along with their
total count, active count, size, and reclaimable space for each resource
type.

Active resources are determined by container mount references and
running state, while reclaimable space is calculated from inactive or
stopped resources.

Example output:
```
~/container ❯ container system df
TYPE           TOTAL  ACTIVE  SIZE      RECLAIMABLE
Images         4      3       4.42 GB   516.5 MB (11%)
Containers     4      2       2.69 GB   1.51 GB (56%)
Local Volumes  3      2       208.5 MB  66.2 MB (32%)
```

I'll have some follow-on PRs that will add `-v/--verbose` flag for
detailed per-resource information, `--filter` flag for filtering output
by resource type, and a `--debug` flag for debug statistics like block
usage, clone counts etc.

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [ ] Added/updated docs
2025-11-20 09:19:00 -08:00
Danny Canter cf0eba495e Implement container stats (#851)
Closes #824

This implements statistics gathering across the various components, but
ultimately this is for implementing a new CLI command: `container
stats`. This shows memory usage, cpu usage, network and block i/o and
the number of processes in the container. The new command can inspect
stats for 1-N containers and by default continuously updates in a `top`
like stream.

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

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs
2025-11-18 14:10:05 -08:00
Danny Canter 14f1df59bf CLI: Implement exec -d (#852)
Surprised we didn't have this already..
2025-11-07 12:46:00 -08:00
Raj 56f6d734f3 UX: fix typos, grammar and consistency issues (#845)
Fixes several typos, grammatical errors, and consistency issues to make
the UX smoother :)
2025-11-04 13:35:29 -08:00
Saehej Kang cd7c3a12c8 [options]: Replace --disable-progress-updates with --progress (none | ansi) (#808)
Part 1 of #641
2025-11-01 14:24:50 -07:00
Danish Singh Sethi c909cb3a27 Add --mac-address flag to set custom MAC addresses for containers (#753)
- Closes #752.
- Currently, there is no way to specify a custom MAC address for a
container's network interface and the MAC address is auto-generated by
the system.
- Use Cases
  - **Network Testing**: Developers testing network-dependent applications
that need predictable MAC addresses
  - **License Management**: Running containerized software with MAC-based
license keys
  - **Network Automation**: Scripts and tools that expect specific MAC
addresses for configuration
  - **Debugging**: Consistent MAC addresses across container restarts for
easier troubleshooting
2025-10-30 16:26:06 -07:00
Dmitry Kovba ea26cce50a Update documentation (#805)
Updates documentation according to the currently supported commands and
displayed help strings.
2025-10-29 09:04:24 -07:00
Danny Canter 9f8a0fb87d Build: Fallback to Containerfile if Dockerfile not found (#812)
Closes #782 #99

If a Dockerfile can't be found in the context dir, check for the common
alternative Containerfile. This does not implement .containerignore
also, solely Containerfile for now. This also funnily enough fixes us
not checking for the Dockerfile IN the context directory.. woops.

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

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs
2025-10-27 08:28:29 -07:00
Dmitry Kovba f2b3cbdd73 Lowercase stdin, stdout, stderr (#807)
Lowercased stdin, stdout, stderr.
2025-10-25 06:55:45 -07:00
Saehej Kang 671725c815 [command-reference]: Document what "auto" means in container run (#765)
## Type of Change
- [ ] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [x] Documentation update

## Motivation and Context

Closes #746

## Testing
- [ ] Tested locally
- [ ] Added/updated tests
- [x] Added/updated docs
2025-10-22 13:49:54 -07:00
Raj b4c3ebfed8 add volume prune command (#783)
- Closes #508.

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

## Motivation and Context
Adds a `container volume prune` command that removes volumes with no
container references and reports the amount of disk space reclaimed.
This helps users clean up unused volumes and easily reclaim disk space.

Also updates the `volume delete` documentation to clarify and highlight
how the `--all` flag works.

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs
2025-10-21 16:58:11 -07:00
Raj ce40ffd33d add support for multiple --tag flags in build (#785)
- Closes #732.

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

## Motivation and Context
Adds support for specifying multiple `-t` / `--tag` flags with the
`build` command. All specified tags will point to the same built image.

Example:
`container build -t myapp:latest -t myapp:v1.0.0 -t myapp:stable .`

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs
2025-10-21 13:03:46 -07:00
Raj 2f8de3a660 Implicitly create named volumes (#769)
- Closes #690.

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

## Motivation and Context
Named volumes are now implicitly created when referenced in container
commands. So, if `myvolume` doesn't exist and you run `container run -v
myvolume:/data alpine`, it is automatically created.

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs
2025-10-16 14:48:57 -07:00
Raj f90f67ccf0 Add support for anonymous volumes (#768)
- Closes #726.

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

## Motivation and Context
Adds support for anonymous volumes. Users can now create volumes without
explicit naming using `-v /path` and `--mount type=volume,dst=/path`
syntax.

Usage:
```
# anonymous volume  
container run -v /data alpine
container run -v anon-01k7jpghe4kg4ph5a4vkccksbb:/data alpine

# Multiple anonymous volumes
container run --rm -v /logs -v /cache -v /tmp alpine
```

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs
2025-10-15 17:33:49 -07:00
siikamiika d8eb510e1e Support --subnet in network create (#737)
> [!CAUTION]
> Just noticed you can actually create a network that conflicts with an
existing network not managed by `network create`. Unless that is fine do
not merge!

Currently containerization only supports IPv4.

Example:
<img width="2012" height="578" alt="screenshot"
src="https://github.com/user-attachments/assets/38fef1ef-3ffd-4d77-b9e2-8c43f7e4851d"
/>



Docker ref: https://docs.docker.com/reference/cli/docker/network/create/
Podman ref:
https://docs.podman.io/en/v5.0.3/markdown/podman-network-create.1.html#subnet-subnet

Fixes apple/container#458

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

## Motivation and Context
[Why is this change needed?]

Scripted creation of deterministic network environments for containers

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [x] Added/updated docs
2025-10-13 16:30:10 -07:00
J Logan f3b33ffc45 Cleans up option groups, container subcommand help. (#647)
- Part of #515.
- Add titles to option groups for container subcommands.
- Order option groups and container subcommand options alphabetically.
- Use `container-id` and `container-ids` consistently as argument names.
- Shorten long valueNames to avoid option column overflow in help output
where possible.
- Replace customShort and customLong with short, long, and shortAndLong
where possible.
- Always place global options and arguments after alphabetized
command-specific options.
- Rename RunCommand to ContainerRun and relocate it.
- Rename Executable to ContainerCLI.

## Type of Change
- [ ] Bug fix
- [ ] New feature  
- [x] Breaking change (if you're depending on `RunCommand`, renamed).
- [ ] Documentation update

## Motivation and Context
See #385.

## Testing
- [ ] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
2025-09-22 16:36:07 -07:00
J Logan 449f1d23df Replace scattered defaults subcommands with system property. (#604)
Common subcommands for all defaults.

- Closes #384.
- Replaces `registry default` and `system dns default` subcommands with
`system property`.
- Users can use `system property ls` to see details about each supported
default value.
- `system property set` implements reasonable validation for all
properties.
- NOTE: Probing of the registry for `registry default set` was removed,
which means users will find out about a botched setting when pulling or
pushing.
- Updates docs.

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

## Motivation and Context
See #384.

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs
2025-09-16 13:37:55 -07:00
J Logan a54be363f7 Add --labels for networks. (#600)
- Closes #557.
- Breaking change: removes `.upToNextOption` for labels on volumes as
this is not what is done for containers, and it forces the argument to
precede the options if a label is supplied, which is non-intuitive.

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

## Motivation and Context
Consistent features and UX across managed resources.

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs
2025-09-15 11:27:51 -07:00
Sidhartha Mani e42fe80aa0 Create command-reference.md (#445)
Fixes https://github.com/apple/container/issues/375
2025-08-29 10:23:45 -07:00