bash completion for Docker and kubernetes !

Updated on June 20th 2019 with Helm, Kubernetes and Minikube !

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 :


2 réflexions sur « bash completion for Docker and kubernetes ! »

  1. I ran into the following issue when tabbing for anything that includes colon :
    -bash: __ltrim_colon_completions: command not found

    Need to add the following in the ~/.bash_profile
    if [ -f $(brew –prefix)/etc/bash_completion ]; then
    . $(brew –prefix)/etc/bash_completion

  2. I’ve just installed these autocompletions with latests versions and it works great.
    During bash-completion installation it shows a message noticing that you’ve to put that if .. fi commented previously on your bash_profile, it seems to be their standard way.

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée.