bash completion for Docker

When you interact a lot with command line tools, such as : docker , docker-machine and docker-compose, command line completion (using the tab key) is a must.

Let’s have a look at how to enable bash completion for those docker command line tools

Mac user ? install bash-completion

I suppose you already use brew on Mac to install additional packages; it’s time to install bash-completion :

Bash completion for docker, docker-machine and docker-compose

Run those 3 commands :

and add the following to the end of your ~/.bash_profile (or ~/.bash_rc if running Linux) :

Now source (if running Linux, source ~/.bash_rc)

And enjoy tab’ing :

References :