Regularly clean your dangling containers and images.
Step 1: cleaning containers (don’t worry, it destroys only stopped containers)
docker ps -aq| xargs docker rm
Step 2: removing dangling images
docker rmi $(docker images -q --filter "dangling=true")
Docker itself offers a number of tools to prune and clean up space
- Inspecting docker filesystem:
docker system df - Pruning stopped containers:
docker container prune - Removing all unused local volumes:
docker volume prune -
docker system prunewill remove- all stopped containers
- all networks not used by at least one container
- all dangling images
- all dangling build cache