docker-bash and docker-stop-all

I’ve been using Docker a fair bit at work, so I’ve added a few quick aliases to my dotfiles make that a little bit easier:

  • docker-bash - attach a bash shell to the first available docker instance
  • docker-stop-all - stop all running docker instances

The implementation for both is pretty straight forward:

docker-bash:

docker exec -it `docker ps -q | head -n 1` bash

docker-stop-all:

docker ps -q | xargs docker stop

Neither is that complicated to remember, but I type both often enough throughout the day that it’s nice to save that dozen or so characters.

comments powered by Disqus