While using Docker for active development, you can get into the situation when Docker runs out of disk space and this might be a bit confusing. Besides, Docker command line doesn’t provide a “no brainer” command to start from scratch. Here’s the reference to a github issue regarding the topic.
So, making the long story short, here are few commands you can use for cleaning up your Docker environment:
Stop all containers:
docker kill $(docker ps -q)
Remove all containers:
docker rm $(docker ps -a -q)
Remove all docker images:
docker rmi $(docker images -q)
Warning: This will destroy all your images and containers. It will not be possible to restore them!
Enjoy your day and read more docker articles here!