How to Sterilize your Docker Host
Here is a pretty handy set of commands that will clean out your Docker host of all containers and images. It’s useful when resetting a demo environment to start fresh.
Step 1: Stop all docker images
docker stop $(docker ps -aq)
Step 2: Remove all containers
docker rm $(docker ps -aq)
Step 3: Remove all images
docker rmi $(docker images -q)
Now running “docker images” command and you will see no images there: