Docker PowerShell commands and AutoHotKey


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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.