How to configure Bash Completion on Mac for Docker, Docker-Machine and Docker-Compose
Run:
brew install bash-completionAdd the following lines to your ~/.bash_profile:
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fiAssuming you're using "Docker for Mac" from store.docker.com, it's idea to use the bash completion files that come with it. The Docker for Mac client keeps itself up to date and comes with the latest completion changes, which are often. Also, the Docker for Mac method includes docker-machine's completion too. Read more at their docs site or just see the below:
# After you've installed Docker for Mac and the brew bash completion steps
ln -s /Applications/Docker.app/Contents/Resources/etc/docker.bash-completion /usr/local/etc/bash_completion.d/docker
ln -s /Applications/Docker.app/Contents/Resources/etc/docker-machine.bash-completion /usr/local/etc/bash_completion.d/docker-machine
ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion /usr/local/etc/bash_completion.d/docLogout/login to your shell, or source ~/.bash_profile.