canasta image prune
canasta image prune
Reclaim container image storage on a host
Synopsis
Remove container images the host no longer needs, and their orphaned layers. Upgrades leave superseded Canasta images behind, and repeated pushes of the same tag (e.g. the :local tags used by --build-from, build: sidecars, and image push) orphan the previous push's layers. Nothing else ever collects them, so the disk only grows until this runs.
On a Docker host, removes the Canasta image tags no instance registered on the host is pinned to, then prunes dangling layers. On a Kubernetes host, prunes containerd images no pod references, then runs the in-cluster registry's garbage collector (with --delete-untagged) and restarts the registry so its in-memory blob cache matches the pruned store. A host running both is reclaimed on both paths.
Volumes are never touched, and an image an instance on the host is pinned to is kept whether or not that instance is running.
Avoid pushing images while the prune runs — a push racing the registry garbage collector can be corrupted (a limitation of the registry itself).
canasta image prune [flags]
Examples
canasta image prune
canasta image prune --dry-run
canasta image prune -H prod1
Flags
| Flag | Shorthand | Description | Default | Required | Orchestrator |
|---|---|---|---|---|---|
--dry-run |
Report what would be removed without removing anything | Both | |||
--host |
-H |
Target host (a saved host name or user@hostname; default: localhost) | Both |
Global flags
| Flag | Shorthand | Description | Default | Required | Orchestrator |
|---|---|---|---|---|---|
--help |
-h |
Show help message and exit | Both | ||
--verbose |
-v |
Enable verbose output | Both |