Docker - Images - Remove old and unused images

Delete ALL dangling data:

docker system prune 

i.e. In order: containers stopped, volumes without containers and images with no containers). Even unused data, with -a option.

You also have:

docker container prune
docker image prune
docker network prune
docker volume prune

For unused images, use docker image prune -a (for removing dangling and ununsed images).

WARNING: 'unused' means “images not referenced by any container”: be careful before using -a.

docker system prune –all will remove all unused images not just dangling ones… which can be a bit too much.


Combining docker xxx prune with the –filter option can be a great way to limit the pruning (docker SDK API).

The currently supported filters are:

See Prune images for an example.