Docker is an excellent tool, some times I forget or don’t bother to delete old containers or images. After using docker on a project for a while I often find I have 100s of old unneeded containers and image that need to be deleted. Here is an easy way to delete all containers and images, I hope you find it useful,
Put these in a bash script, mark the bash script as executable.
#!/bin/bash docker stop $(docker ps -a -q)
docker rm `docker ps -notrunc -a -q`
docker rmi $(docker images -a -q)