Cleanup after Docker

I often find myself in a situation where I have several redundant Docker containers and/or images; usually after development of a new container/image and forgetting to use a flag like run --rm.

Unfortunately, Docker doesn’t provide a built-in command to cleanup after itself.

Instead, one must call Docker’s remove commands with the output of Docker’s list commands.

To remove all containers:

$ docker stop $(docker ps -a -q)
$ docker rm $(docker ps -a -q)

To remove all ‘untagged’ images:

$ docker rmi $(docker images | grep "^<none>" | awk "{print $3}")

Now read this

A foray into sketchnoting

I’ve always admired people who can clearly visualise complex topics. I’ve sat and watched Draw my Life videos on YouTube. I’ve watched Scrum Masters quickly and beautifully visualise a Sprint retrospective in real-time. I’ve seen... Continue →