Docker Cleanup Commands

If you see Docker claiming lot of space on your computer and if you want to reclaim all of your space back from Docker, use following Docker commands for cleanup. Make sure you are aware that this will delete images and containers from your machine, make sure you do not run this on production machines unless you know what you are doing 😎.

How to remove docker’s unused data?

docker system prune —force

To delete everything

docker system prune -a --volumes

How to delete all docker containers including its volumes use?

docker rm -vf $(docker ps -a -q)

How to delete all docker images?

docker rmi -f $(docker images -a -q)

These commands helped me to reclaim more than 10GB of data for only few months of work with Docker.

What is this Site?

viralpatel.blog is started by me, Viral Patel, as a place to write posts and blogs about problems that I personally face during my day to day and share new learnings about software development work. Even though there is abundant of information out there via various personal blogs or blogs written by technical companies, day in and day out, We as software developers face different problems. By starting out this blog, I wish to explore different problem solving patterns and software design practices that will make easier to build quality and useful software.