Commands
I’m doing quite a few exercies with Docker in the last fiew days. I start to notice that I need a toolkit of useful commands to cleanup all the containers or images that I move around.
I record here, for future memory, a collection of useful PowerShell script.
Bonus point: an AHK (AutoHotKey) script to be able to rapidly insert those commands with just a few chars!
# Maintenance commands or utils
docker container prune # Remove all stopped containers
docker volume prune # Remove all unused volumes
docker image prune # Remove unused images
docker system prune # All of the above, in this order: containers, volumes, images
docker ps -a -q | % { docker rm $_ } # Remove all containers
docker images -q | % { docker rmi $_ } # Remove all images
docker volume rm $(docker volume ls -f dangling=true -q) # Remove all volumes