Docker shell completion on OSX iTerm2 oh-my-zsh

Viewed 13415

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

3 Answers

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.

  1. Run vim ~/.zshrc on your iTerm2
  2. Find the line that contains plugins=() which normally will have git for example plugins=(git)
  3. make a change by pressing I at that line ( i for Insert Mode)
  4. change to plugins=(docker git) to add the docker extension and place ESC to exit insert mode
  5. save by type :w to save and exit by type :x
  6. restart your iTerm2 then docker completion should work now
Related