First install the following formulas:
AnnouncementI have released my new course on Udemy, Kubernetes By Example. Sign up now to get free lifetime access!
brew install bash-completion brew cask install docker
Next via the gui launcher, find the docker icon and launch it, then follow the prompts. Then restart your bash terminal. Now run the following command to create a few symbolic links:
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/docker-compose
Then restart the bash terminal. Therefore running the above ln commands resulted in the following files being created:
$ pwd /usr/local/etc/bash_completion.d $ cd /usr/local/etc/bash_completion.d/ $ ll | grep docker -rw-r--r-- 1 schowdhury admin 15 19 Oct 11:18 docker -rw-r--r-- 1 schowdhury admin 15 19 Oct 11:18 docker-compose -rw-r--r-- 1 schowdhury admin 10347 19 Oct 11:18 docker-machine -rw-r--r-- 1 schowdhury admin 1469 19 Oct 11:19 docker-machine-prompt -rw-r--r-- 1 schowdhury admin 1525 19 Oct 11:18 docker-machine-wrapper