Preview a Docker prune before it deletes

Updated 29 November 2026

Docker's prune commands have no dry-run option. docker system prune tells you which kinds of things it will remove, such as "all stopped containers", and asks y/N, but not which ones. dpad shows the list first.

Source: Docker's docker system prune reference lists --all, --filter, --force and --volumes, and no dry-run flag.

How it works

  1. In dp, press X. The preview opens on the kind that matches your tab: images on Images, volumes on Volumes, networks on Networks, stopped containers anywhere else.
  2. tab and shift+tab move between kinds. a widens images and volumes, as below.
  3. Read the list. Nothing is removed yet.
  4. Press y.
Prune preview listing the stopped containers that would be removed
The stopped containers a prune would remove.
KindThe preview listsWith aMatches
Containersexited, created and dead containersdocker container prune
Imagesuntagged images no container usesalso tagged images no container usesdocker image prune (--all)
Volumesanonymous volumes no container mountsalso named volumes no container mountsdocker volume prune (--all)
Networksuser-defined networks no container usesdocker network prune
Build cachebuild cache records not in usedocker builder prune --all
Systemall of the above except volumes, with every unused image, tagged or notdocker system prune --all

"No container" includes stopped ones, so an image or volume that a stopped container still uses stays. Sizes are shown for images and build cache. Image sizes include layers shared with other images, so they are not a promise of disk space freed.

A whole system prune

The last kind, system, is one shift+tab from stopped containers. It lists what docker system prune -a would remove: stopped containers, then the networks and images (tagged or not) that no remaining container uses, then unused build cache. An image that only a stopped container used is on the list, because that container goes first. Volumes are kept, as they are without --volumes.

The title counts each kind, for example prune system · 3 containers · 1 network · 12 images · 40 cache records · 2.1GB, and a TYPE column says what each row is. After y, the kinds are removed in that order.

Only what you saw

After y, dpad reads the list again. If it changed since the preview, you get the new preview and need another y. Otherwise it removes exactly the resources you saw, one request each and never forced, so anything that started being used in the meantime fails with Docker's error instead of disappearing. Each row then says removed, failed or unknown (interrupted, may have applied); select a failed row to read the error. esc during removal cancels the rest.

Build cache is the exception: Docker has no call to remove a single record, so it is pruned in one request, and the summary counts any records created after the preview that went too.

Without dpad

To get close with the Docker CLI alone, list before you prune:

$ docker ps -a --filter status=exited --filter status=created --filter status=dead
$ docker images --filter dangling=true
$ docker volume ls --filter dangling=true
$ docker network ls --filter type=custom

These show candidates, but the prune that follows is a separate command and removes whatever matches at that moment.

Full reference: Prune.