This concise article shows you how to remove unused containers and images from your computer to gain free disk space.
First, check images space usage, containers space usage, local volumes usage, and build cache usage by performing the following command:
docker system df -v
You will see a lot of information like this:
Now you can delete all build-cache, unused networks, stopped containers, and dangling images by executing the command below:
docker system prune
You will be asked to confirm your decision. Enter “y” to continue:
When the process is done, you will see a message like this:
Total reclaimed space: 1343541B
Done. Further reading:
- Docker Desktop: Change images & containers directory
- How to reset Docker Desktop
- Limit resources consumed by Docker Desktop
- Docker: Execute Commands inside a Running Container
- How to enable Kubernetes in Docker Desktop
You can also check out our Docker topic page for the latest tutorials, examples, tips, and tricks.