Cleaning Up Docker Host

Sometimes testing docker images consumes a lot of diskspace depending on what you're using, if you're like me and don't have a brand new 1TB SSD then we can't afford to have diskspace wasted.

Here's a quick 3 line command to:
1. Stop all docker contaienrs
2. Remove all docker containers
3. Remove all docker images

docker stop $(docker ps -a -q)  
docker rm $(docker ps -a -q)  
docker rmi $(docker images -q)  

Now we can start fresh and try or build new docker containers. Also note, if you created external volume mount folders these commands won't remove them.

comments powered by Disqus