How to Bulk Delete Unused Docker Images, Containers, Volumes, Networks, and Cache
Tadashi Shigeoka · Sat, July 27, 2019
This article introduces how to bulk delete unused Docker images, containers, volumes, networks, build cache, and more.
Bulk Delete Unused containers, networks, volumes, images, and build cache
docker system prune --volumes
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all volumes not used by at least one container
- all dangling images
- all build cache
Are you sure you want to continue? [y/N]
docker system prune | Docker Documentation
Unused docker containers
List unused docker containers
docker ps -a -f status=exited
Bulk delete unused docker containers
docker rm $(docker ps -a -f status=exited -q)
Unused docker volumes
List unused docker volumes
docker volume ls -f dangling=true
Delete unused docker volumes
docker volume prune
docker volume prune | Docker Documentation
Unused docker images
List unused docker images
docker images -f dangling=true
Bulk delete unused docker images
docker images purge
docker image prune | Docker Documentation
Unused docker networks
Bulk delete unused docker networks
docker network purge
docker network prune | Docker Documentation
That’s all from the Gemba on bulk deleting unused Docker images, containers, volumes, networks, build cache, and more to free up disk space.