I have followed the instructions for installing command line completion functionality for the docker command in Mac with bash-completion, from https://docs.dock
docker