[container]: add clean command (#1949)

- Closes #1763
- `container clean` marks deallocated filesystem blocks
  in the container VM so that the host can reclaim the
  unused capacity.
This commit is contained in:
Saehej Kang
2026-09-01 11:32:31 -07:00
committed by GitHub
parent 97a0c11a6e
commit b8ffd38c73
14 changed files with 345 additions and 0 deletions
+24
View File
@@ -413,6 +413,30 @@ container export -o mycontainer.tar mycontainer
container export mycontainer > mycontainer.tar
```
### `container clean`
Cleans unused space on the root filesystem and each named volume mount in one or more running containers. The command only works while the container is running.
**Usage**
```bash
container clean [--debug] <container-ids> ...
```
**Arguments**
* `<container-ids>`: Container IDs
**Examples**
```bash
# clean a single running container
container clean mycontainer
# clean multiple running containers
container clean mycontainer1 mycontainer2
```
### `container logs`
Fetches logs from a container. You can follow the logs (`-f`/`--follow`), restrict the number of lines shown, or view boot logs.