From e42fe80aa080f72b13cb26c0a41d07f4edc47004 Mon Sep 17 00:00:00 2001 From: Sidhartha Mani Date: Fri, 29 Aug 2025 17:23:45 +0000 Subject: [PATCH] Create command-reference.md (#445) Fixes https://github.com/apple/container/issues/375 --- .github/pull_request_template.md | 17 + README.md | 1 + docs/command-reference.md | 751 +++++++++++++++++++++++++++++++ 3 files changed, 769 insertions(+) create mode 100644 .github/pull_request_template.md create mode 100644 docs/command-reference.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..af5dfb21 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,17 @@ +## Type of Change +- [ ] Bug fix +- [ ] New feature +- [ ] Breaking change +- [ ] Documentation update + +## Description +[Brief description] + +## Motivation and Context +[Why is this change needed?] + +## Testing +- [ ] Tested locally +- [ ] Added/updated tests +- [ ] Added/updated docs + diff --git a/README.md b/README.md index 6526081e..df6f52b6 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ uninstall-container.sh -k - Take [a guided tour of `container`](./docs/tutorial.md) by building, running, and publishing a simple web server image. - Learn how to [use various `container` features](./docs/how-to.md). - Read a brief description and [technical overview](./docs/technical-overview.md) of `container`. +- Browse the [full command reference](./docs/command-reference.md). - [Build and run](./BUILDING.md) `container` on your own development system. - View the project [API documentation](https://apple.github.io/container/documentation/). diff --git a/docs/command-reference.md b/docs/command-reference.md new file mode 100644 index 00000000..f7907665 --- /dev/null +++ b/docs/command-reference.md @@ -0,0 +1,751 @@ +# Container CLI Command Reference + +Note: Command availability may vary depending on host operating system and macOS version. + +## Core Commands + +### `container run` + +Runs a container from an image. If a command is provided, it will execute inside the container; otherwise the image's default command runs. By default the container runs in the foreground and STDIN remains closed unless `-i`/`--interactive` is specified. + +**Usage** + +```bash +container run [OPTIONS] IMAGE [COMMAND] [ARG...] +``` + +**Options** + +* **Process and resources** + * `-w, --cwd, --workdir `: Current working directory for the container + * `-e, --env `: Set environment variables + * `--env-file `: Read in a file of environment variables + * `--uid `: Set the uid for the process + * `--gid `: Set the gid for the process + * `-i, --interactive`: Keep Stdin open even if not attached + * `-t, --tty`: Open a tty with the process + * `-u, --user `: Set the user for the process + * `-c, --cpus `: Number of CPUs to allocate to the container + * `-m, --memory `: Amount of memory in bytes, kilobytes (K), megabytes (M), or gigabytes (G) for the container, with MB granularity (for example, 1024K will result in 1MB being allocated for the container) +* **Container management** + * `-d, --detach`: Run the container and detach from the process + * `--entrypoint `: Override the entrypoint of the image + * `--mount `: Add a mount to the container (type=<>,source=<>,target=<>,readonly) + * `-p, --publish `: Publish a port from container to host (format: [host-ip:]host-port:container-port[/protocol]) + * `--publish-socket `: Publish a socket from container to host (format: host_path:container_path) + * `--tmpfs `: Add a tmpfs mount to the container at the given path + * `--name `: Assign a name to the container. If excluded will be a generated UUID + * `--remove, --rm`: Remove the container after it stops + * `--os `: Set OS if image can target multiple operating systems (default: linux) + * `-a, --arch `: Set arch if image can target multiple architectures (default: arm64) + * `-v, --volume `: Bind mount a volume into the container + * `-k, --kernel `: Set a custom kernel path + * `--network `: Attach the container to a network + * `--cidfile `: Write the container ID to the path provided + * `--no-dns`: Do not configure DNS in the container + * `--dns `: DNS nameserver IP address + * `--dns-domain `: Default DNS domain + * `--dns-search `: DNS search domains + * `--dns-option `: DNS options + * `-l, --label