# How to Get Help on Specific Commands in the Apple Container CLI

> Easily find help for apple container CLI commands. Learn how to display usage details using --help or the help sub-command.

- Repository: [Apple/container](https://github.com/apple/container)
- Tags: how-to-guide
- Published: 2026-07-06

---

**You can display detailed usage information for any apple/container command by appending `--help` to the root command or any sub-command, or by using the `help` sub-command as an alias.**

The apple/container repository provides a powerful CLI for managing containers on Apple platforms. Built with the Swift ArgumentParser library, the tool automatically generates comprehensive help documentation for every command and flag directly from source code annotations. Understanding how to access this built-in help ensures you can quickly discover available options without leaving the terminal.

## Three Methods to Access Help

The `container` command implements three distinct ways to retrieve help text, depending on whether you need an overview or specific sub-command details.

### Root-Level Help

Running the `--help` flag on the base command displays a general overview of the CLI. This output includes global flags such as `--debug`, `--version`, and `-h/--help`, plus a complete list of all available sub-commands.

```bash
container --help

```

### Sub-Command Help

To view detailed usage for a specific operation, append `--help` to any sub-command. This reveals the full description, positional arguments, and all flags available for that particular command.

```bash
container run --help
container image pull --help

```

### Help Alias

The root command defines a `help` sub-command that forwards to ArgumentParser’s help system. This provides identical output to the `--help` flag but uses a different syntax that some users find more intuitive.

```bash
container help build
container help image pull

```

## How Help Text Is Generated

The help output is not static documentation; it is dynamically generated from the source code. In [`Sources/Services/ContainerAPIService/Client/Flags.swift`](https://github.com/apple/container/blob/main/Sources/Services/ContainerAPIService/Client/Flags.swift) (lines 58-84), the `@Option` and `@Flag` property wrappers include `help:` strings that populate the CLI output.

For example, flags like `--env`, `--cpus`, and `--memory` are defined with descriptive help text that appears when you run `container run --help`. This ensures the documentation always stays synchronized with the implementation.

## Key Reference Files

Several files in the repository provide authoritative sources for understanding the help system:

- **[`docs/tutorials/start-here.md`](https://github.com/apple/container/blob/main/docs/tutorials/start-here.md)** — Contains the "Get CLI help" section explaining the `--help` flag usage
- **[`docs/command-reference.md`](https://github.com/apple/container/blob/main/docs/command-reference.md)** — Exhaustive reference for every sub-command with usage blocks mirroring `--help` output
- **[`Tests/IntegrationTests/ContainerCommandsTests/HelpCommandTests.swift`](https://github.com/apple/container/blob/main/Tests/IntegrationTests/ContainerCommandsTests/HelpCommandTests.swift)** — Unit tests verifying the help command resolves correctly for all aliases

## Summary

- Append `--help` to any `container` command to see usage details and available flags
- Use `container help <subcommand>` as an alternative syntax to `--help`
- The help text is auto-generated from `@Option` and `@Flag` annotations in [`Sources/Services/ContainerAPIService/Client/Flags.swift`](https://github.com/apple/container/blob/main/Sources/Services/ContainerAPIService/Client/Flags.swift)
- Global flags like `--debug` and `--version` appear only in the root help output
- Comprehensive documentation mirrors the CLI output in [`docs/command-reference.md`](https://github.com/apple/container/blob/main/docs/command-reference.md)

## Frequently Asked Questions

### How do I see all available sub-commands in apple/container?

Run `container --help` to display the root-level help, which lists every available sub-command along with global flags. This provides the fastest way to discover what operations the CLI supports without reading external documentation.

### Why does `container help run` show the same output as `container run --help`?

The `help` sub-command is implemented as an alias that forwards to the same ArgumentParser help system used by the `--help` flag. As verified in [`Tests/IntegrationTests/ContainerCommandsTests/HelpCommandTests.swift`](https://github.com/apple/container/blob/main/Tests/IntegrationTests/ContainerCommandsTests/HelpCommandTests.swift), both methods resolve to identical output, so you can use whichever syntax you prefer.

### Where are the flag descriptions defined in the source code?

Flag descriptions are defined in [`Sources/Services/ContainerAPIService/Client/Flags.swift`](https://github.com/apple/container/blob/main/Sources/Services/ContainerAPIService/Client/Flags.swift) using the Swift ArgumentParser library. Each `@Option` or `@Flag` property wrapper includes a `help` parameter (lines 58-84) that provides the descriptive text displayed in the terminal when you request help.

### Does the help output include environment variable overrides?

Yes, the automatically generated help screens include information about environment variables that can override flag values. This is part of the standard Swift ArgumentParser behavior implemented throughout the apple/container CLI, ensuring you can see both command-line flags and their environment-based alternatives in the same view.