Docker Tip #1 - Kill all your containers

When developing with Docker you'll probably find a need to kill all your docker containers at once. While you certainly can kill them one by one the following command line takes care of it in a one-liner.


    docker kill $(docker ps -q)
        

If you use a bash shell I would recommend you create an alias for it so you can issue the command line in one go.


    alias docker-kill='docker kill $(docker ps -q)'
        

Enjoy!

Posted August 21, 2016

Up