docker cleanup commands

2016-11-14

Today I learnt a couple of docker commands

I’m heavily experimenting with docker at the moment and I’ve noticed a big chunck of my hard drive has been taken up by swaths of stopped containers and untagged images.

To remove stopped containers, simply run

1
2
# Remove all stopped containers
docker rm $(docker ps -a -q)

To delete untagged images, simply run

1
2
# Remove all untagged images
docker rmi $(docker images -q)

Now I get to enjoy my reclaimed SSD space!!!