Docker system prune
docker system prune
will delete ALL dangling data. even unused data, with -a
option.
You also have:
docker container prune (delete all container)
docker image prune
(delete all image)docker network prune
(delete all network)docker volume prune
(delete all volume)
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
.
As illustrated in A L's answer, docker system prune --all
will remove all unused images not just dangling ones... which can be a bit too much.
cr. https://stackoverflow.com/questions/32723111/how-to-remove-old-and-unused-docker-images