Skip to content

Command Line Tools

wheels deploy prune images

Remove the service’s unused images on every host.

"
wheels deploy prune images [--destination=<name>] [--dry-run]
FlagDescription
--destination=<name>Overlay destination config.
--dry-runPrint the commands without executing.

Per host, emits docker image prune --all --force --filter label=service=<service>. It removes every image of the service that no container uses, tagged images of old versions included. Images used by any container, running or stopped, are kept.

Rollback isn’t affected while a version’s container still exists: wheels deploy rollback <version> restarts that version’s existing container (docker start) and doesn’t pull, and an image in use by a stopped container is kept. Once prune containers has removed a version’s container, the next prune images removes its image too. Going back to that version then means deploying it again with wheels deploy --version=<version> --skip-push, which pulls that version’s image from the registry instead of building the current checkout.

The label comes from wheels deploy build push, which sets service=<service> on every image it builds. Images built before that label was added carry none, so this command doesn’t remove them; remove those once with docker image rm.

illustrative
wheels deploy prune images