Docker is no doubt a great tool for deploying applications on the go. By the time you are done learning it, your machine will have dozens of images and “test” containers. Leaving them as is will create a similar mess your “Downloads” folder is facing.
How nice if there is a way to delete all containers and images in one line of code 🙂
Deletes all stopped containers, images without containers
$ docker system prune
$ docker system prune –volume
To delete all item by item
To list all active / inactive Container IDS only
$ docker ps -aq
To stop all containers by id
$ docker stop $(docker ps -aq)
To delete all containers by id
$ docker rm $(docker ps -aq)
To delete all images by id
$ docker rmi $(docker images -q)
Happy PCs !! Happy Containers !!