mirror of
https://github.com/apple/container.git
synced 2026-08-28 19:36:31 +00:00
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
This commit is contained in:
@@ -921,6 +921,20 @@ container system logs [--follow] [--last <last>] [--debug]
|
||||
* `-f, --follow`: Follow log output
|
||||
* `--last <last>`: Fetch logs starting from the specified time period (minus the current time); supported formats: m, h, d (default: 5m)
|
||||
|
||||
### `container system df`
|
||||
|
||||
Shows disk usage for images, containers, and volumes. Displays total count, active count, size, and reclaimable space for each resource type.
|
||||
|
||||
**Usage**
|
||||
|
||||
```bash
|
||||
container system df [--format <format>] [--debug]
|
||||
```
|
||||
|
||||
**Options**
|
||||
|
||||
* `--format <format>`: Format of the output (values: json, table; default: table)
|
||||
|
||||
### `container system dns create`
|
||||
|
||||
Creates a local DNS domain for containers. Requires administrator privileges (use sudo).
|
||||
|
||||
Reference in New Issue
Block a user