Docker bash completion

Today I’ll write down here my configurations to get Docker bash completion working, looks like a simple thing but I saw some difficulties to get it done properly here and there so.

1# Install Homebrew

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2# Install bash-completion and wget

$ brew install bash-completion
$ brew tap homebrew/completions

3# Update your .bash_profile or .bashrc to execute bash_completion when you open a new terminal

If you prefer to edit, use your editor to add this content :
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi

Or to append this content :

cat >> ~/.bash_profile <<EOL
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
EOL

4# Create the aliases to completions

$ cd /usr/local/etc/bash_completion.d
$ ln -s /Applications/Docker.app/Contents/Resources/etc/docker.bash-completion
$ ln -s /Applications/Docker.app/Contents/Resources/etc/docker-machine.bash-completion
$ ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion

5# reload your .bash*

$ source ~/.bash_profile

That’s it, now you cant try for example

$ docker [tab]
$ docker-compose [tab]
$ docker-machine [tab]

Allan de Queiroz

Allan de Queiroz
London based software engineer

XServer forward from Linux text mode for Headless purposes.

Hello, this post is about XServer forward from Linux text mode, **not ssh forward, anything related to VNC** or things like that.Recently...… Continue reading