Cleaning up after docker

Docker is an awesome tool for packing things into easily deployable artefacts, it also chews up disk space like a world record holding eating champion and doesn’t have any obvious method for removing junk you probably don’t need any more. So here are a couple of quick commands that can be used to clean up after it.

The first one is to remove any containers that aren’t running.

docker rm $(docker ps -a -q)

The secone one is to remove any images that are not currently tagged or attached to a tagged instance.

docker rmi $(docker images -q -f dangling=true)

Look at all that additional disk space! Well that’s all for today 🙂

comments powered by Disqus