Reputation: 6669
I am trying to get Docker shell completion on this stack (OSX iTerm2 oh-my-zsh)
I followed this guide -> https://docs.docker.com/compose/completion/
First I executed this
$ mkdir -p ~/.zsh/completion
$ curl -L https://raw.githubusercontent.com/docker/compose/master/contrib/completion/zsh/_docker-compose > ~/.zsh/completion/_docker-compose
Then I added this two lines almost at the end ~/.zshrc
file
fpath=(~/.zsh/completion $fpath)
autoload -Uz compinit && compinit -i
Then in the terminal I run
source ~/.zshrc
exec $SHELL -l
But when I press tab
it suggest the files and folders on the path
Upvotes: 20
Views: 16693
Reputation: 441
Docker has updated their docs with the answer on how to do this after you have installed Docker Desktop
: https://docs.docker.com/desktop/faqs/macfaqs/#how-do-i-install-shell-completion
Upvotes: 0
Reputation: 31
vim ~/.zshrc
on your iTerm2plugins=(docker git)
to add the docker extension and place ESC to exit insert mode:w
to save and exit by type :x
Upvotes: 1
Reputation: 1676
Make sure you have the lastest version of oh-my-zsh
by running: upgrade_oh_my_zsh
Also, it can't hurt to run rm ~/.zcompdump*
after trying all the other answers.
Fixed it for me.
Upvotes: 12
Reputation: 2667
You set up the completion for docker-compose
not for docker
. If you would like add the docker
completion too then run the following command and reload your shell.
curl -L https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/zsh/_docker > ~/.zsh/completion/_docker
Add the docker
plugin to the .zshrc
's plugin list:
docker
to the plugins list like this:
plugins=(docker ...)
Upvotes: 47