Short Notes

Docker clean all containers, images and volumes

Stop all containers:

docker stop $(docker ps -a -q)

Stop all containers by force

docker kill $(docker ps -q)

Remove all containers

docker rm $(docker ps -a -q)

Remove all docker images

docker rmi $(docker images -q)

Remove all volumes

docker volume rm $(docker volume ls -qf dangling="true")

Purge the rest

docker system prune --all --force --volumes

Combined to clear everthing at once

docker kill $(docker ps -q) ; docker rm $(docker ps -a -q) ; docker rmi $(docker images -q) ; docker volume rm $(docker volume ls -qf dangling="true") ; docker system prune --all --force --volumes
— 23.11.2020