# `container` — Complete CLI Command Reference Full command/flag reference for Apple's `container` CLI (repo `apple/container`), invoked as `container ...` on Apple-silicon macOS. Flags, defaults, aliases, and behavior are taken from the swift-argument-parser declarations in `Sources/ContainerCommands/` (source of truth) and `docs/command-reference.md`; on conflicts the source wins. Not Docker. The CLI is deliberately Docker-like, but flags, defaults, and daemon model differ — do not assume Docker behavior carries over. Every container runs in its own lightweight VM; there is no shared daemon (per-user `launchd` services). Registry lives under the **Image** group, not top-level. **Conventions used below:** a value of `—` in the Default column means "no default (unset / optional)". "flag" in the Value column means a boolean switch (no argument). `[env: NAME]` marks an environment-variable fallback. Command availability varies by macOS version — caveats are called out inline. **Version:** this reference tracks the **1.0.0** release. Items marked *(1.0.0+)* were added after 0.7.1 — namely `container cp`, `container export`, `container prune`, `container image prune`, `container registry list`, `container system version`, and the whole `container machine` group (on 0.7.1 the `registry` group had only `login`/`logout`). Run `container --help` to confirm what your installed build supports. --- ## Table of Contents - [Global](#global) - [Container lifecycle](#container-lifecycle) - [run](#container-run) · [create](#container-create) · [exec](#container-exec) · [start](#container-start) · [stop](#container-stop) · [kill](#container-kill) · [delete / rm](#container-delete-rm) · [list / ls](#container-list-ls) · [logs](#container-logs) · [inspect](#container-inspect) · [stats](#container-stats) · [copy / cp](#container-copy-cp) · [export](#container-export) · [prune](#container-prune) - [Images](#images) - [build](#container-build) · [image](#container-image-group) · [pull](#container-image-pull) · [push](#container-image-push) · [tag](#container-image-tag) · [save](#container-image-save) · [load](#container-image-load) · [inspect](#container-image-inspect) · [list / ls](#container-image-list-ls) · [delete / rm](#container-image-delete-rm) · [prune](#container-image-prune) - [Registry](#registry) - [login](#container-registry-login) · [logout](#container-registry-logout) · [list / ls](#container-registry-list-ls) - [Builder](#builder) - [start](#container-builder-start) · [status](#container-builder-status) · [stop](#container-builder-stop) · [delete / rm](#container-builder-delete-rm) - [System](#system) - [start](#container-system-start) · [stop](#container-system-stop) · [status](#container-system-status) · [version](#container-system-version) · [logs](#container-system-logs) · [df](#container-system-df) · [dns](#container-system-dns) · [kernel set](#container-system-kernel-set) · [property list](#container-system-property-list-ls) - [Network (macOS 26+)](#network-macos-26) - [create](#container-network-create) · [delete / rm](#container-network-delete-rm) · [list / ls](#container-network-list-ls) · [inspect](#container-network-inspect) · [prune](#container-network-prune) - [Volume](#volume) - [create](#container-volume-create) · [delete / rm](#container-volume-delete-rm) · [list / ls](#container-volume-list-ls) · [inspect](#container-volume-inspect) · [prune](#container-volume-prune) - [Machine](#machine) - [create](#container-machine-create) · [run](#container-machine-run) · [set](#container-machine-set) · [set-default](#container-machine-set-default) · [list / ls](#container-machine-list-ls) · [inspect](#container-machine-inspect) · [logs](#container-machine-logs) · [stop](#container-machine-stop) · [delete / rm](#container-machine-delete-rm) --- ## Global Root command: `container` — "A container platform for macOS". ```bash container [--debug] [--version] [-h|--help] [ ...] ``` | Flag | Value | Default | Description | |------|-------|---------|-------------| | `--debug` | flag | `false` | Enable debug output. Applies to every command (composed via `Flags.Logging`). `[env: CONTAINER_DEBUG]` — setting the env var (any value) also enables debug. | | `--version` | flag | — | Print CLI version (`container CLI version …`) and exit. | | `-h, --help` | flag | — | Show help. On the bare root command, help is augmented with a `PLUGINS:` section. | Notes: - **There is no global `-d` short flag.** `--debug` is long-only. `-d` is `--detach` on `run`/`create`/`exec`/`machine run`. - `--debug` is accepted on essentially every subcommand (each command composes `Flags.Logging`), so it is omitted from the per-command tables below unless useful. - The CLI refuses to run under Rosetta translation (it exits with an error telling you to disable Rosetta in your terminal). Apple silicon only. - Most commands talk to the background API server. If it is not running you get an "XPC connection error" hint: *"Ensure container system service has been started with `container system start`."* Run `container system start` first. ### Command groups Top-level help organizes subcommands into groups: **Container** (lifecycle), **Image** (`build`, `image`, `registry`), **Machine**, **Volume**, and **Other** (`builder`, `network`, `system`). Group aliases: | Group | Alias | Note | |-------|-------|------| | `container image` | `i` | The plural `images` is only the help section header, not a command (`container images` errors with "plugin not found"). | | `container registry` | `r` | Nested under the Image group. | | `container machine` | `m` | | | `container volume` | `v` | | | `container network` | `n` | **macOS 26+ only** (absent on macOS 15). | | `container system` | `s` | | | `container builder` | (none) | | ### Plugin passthrough If the first argument is not a recognized subcommand (and does not start with `-`), the CLI treats it as a **plugin invocation**: it looks for an executable named `container-` and `execvp`s into it, passing through all remaining arguments. - Plugin search directories (in order): the user plugins dir under the install root, the app bundle's `plugins/`, and `/libexec/container/plugins/`. Only plugins whose config declares `isCLI` are eligible. - Requires the system services to be running (the plugin loader queries the API server). If they are not, you get: *"Plugins are unavailable. Start the container system services and retry: `container system start`."* - If no matching plugin is found: *"Plugin 'container-' not found."* with the searched paths listed. - An unknown token starting with `-` yields *"unknown option '…'"*; an empty token yields *"unknown argument '…'"*. - Before exec, `SIGINT`/`SIGTERM` handlers are reset to default so the plugin manages its own signals. ```bash container myplugin --flag arg # execs container-myplugin --flag arg ``` --- ## Container lifecycle The following flag groups are shared (composed via `@OptionGroup`) across `run`, `create`, and — for the process subset — `exec`. They are defined once here and referenced by name. **Process options** (`run`, `create`, `exec`): | Flag | Value | Default | Description | |------|-------|---------|-------------| | `-e, --env` | `` | — | Set env var. `key=value`, or bare `key` to inherit from host. Repeatable. | | `--env-file` | `` | — | Read env vars from a file (`key=value`; ignores `#` comments and blank lines). Repeatable. | | `--gid` | `` | — | Group ID for the process. | | `-i, --interactive` | flag | `false` | Keep stdin open even if not attached. | | `-t, --tty` | flag | `false` | Open a TTY for the process. | | `-u, --user` | `` | — | User for the process (format `name` \| `uid[:gid]`). | | `--uid` | `` | — | User ID for the process. | | `-w, --workdir, --cwd` | `` | — | Initial working directory inside the container. (`-w`, `--workdir`, and `--cwd` are all accepted.) | | `--ulimit` | `=[:]` | — | Resource limit (`RLIMIT_*`, e.g. `nofile=1024:2048`). Repeatable. Part of the shared Process group, so it also parses on `exec`. | **Resource options** (`run`, `create`): | Flag | Value | Default | Description | |------|-------|---------|-------------| | `-c, --cpus` | `` | — | Number of CPUs to allocate. | | `-m, --memory` | `` | — | Memory (1 MiB granularity); optional `K`/`M`/`G`/`T`/`P` suffix. | **Management options** (`run`, `create`): | Flag | Value | Default | Description | |------|-------|---------|-------------| | `-a, --arch` | `` | host arch (e.g. `arm64`) | Arch to use if the image is multi-arch. | | `--cap-add` | `` | — | Add a Linux capability (`CAP_NET_RAW`, `NET_RAW`, or `ALL`). Repeatable. | | `--cap-drop` | `` | — | Drop a Linux capability. Repeatable. | | `--cidfile` | `` | `""` | Write the container ID to this path. | | `-d, --detach` | flag | `false` | Run detached from the process. | | `--dns` | `` | — | DNS nameserver IP. Repeatable. | | `--dns-domain` | `` | — | Default DNS domain. | | `--dns-option` | `