Docker Protips™

Joinville · May 10, 2015

Like my old post on git, this is somewhat a collection of useful Docker commands/tricks/whatever.

Feel free to leave yours in the comments!

Stop all containers

$ docker stop $(docker ps -qa)

You can also kill all running containers instead of stop them.

Delete all stopped containers

$ docker rm $(docker ps -qa -f="exited=0")

This command is particularly useful if you tested a lot of stuff in your machine which is now running out of disk space.

Delete all images

$ docker rmi -f $(docker images -q)

Delete unused images

$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock bobrik/image-cleaner

Kitematic

If you use a Mac, managing boot2docker by hand can be a little "boring", you can use Kitematic for that.

Let's make this list bigger! Have your own tip/trick? Something I forgot to add? Share it with us!