Zsh Docker Plugin not Working

亡梦爱人 提交于 2019-12-03 22:12:20
Shmeinstein

I think you may be missing ,'s in between each plugin.

plugins=(git, colored-man, colorize, github, jira, vagrant, virtualenv, pip, python, brew, osx, zsh-syntax-highlighting, docker)

Alternatively you can place each plugin on a separate line:

plugins=(
  git
  colored-man
  colorize 
  github
  jira
  vagrant
  virtualenv
  pip
  python
  brew
  osx
  zsh-syntax-highlighting 
  docker
)

You might want to try and remove any .zcompdump-(...) files you may have on your user's home directory - using something like rm ~/.zcompdump* on a terminal, or some file browser - and then restart the terminal. See this

Then see if it works.

It seems oh-my-zsh is not loading plugins/docker/_docker file. You must add it to ~/.zshrc in an another way. Add these lines to your ~/.zshrc file:

fpath+=($ZSH/plugins/docker)
autoload -U compinit && compinit

For me it was simply the case that I needed to launch Docker for the first time from spotlight on my Mac in order for Docker for Desktop to get the access it needed. Then the docker version command worked just fine.

Follow these steps if you are using oh-my-zsh and autocomplete is not working:

Step 1:

Make the following three links:

ln -s /Applications/Docker.app/Contents/Resources/etc/docker.zsh-completion /usr/local/share/zsh/site-functions/_docker

ln -s /Applications/Docker.app/Contents/Resources/etc/docker-machine.zsh-completion /usr/local/share/zsh/site-functions/_docker-machine

ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.zsh-completion /usr/local/share/zsh/site-functions/_docker-compose

Step 2:

Either add autoload -Uz compinit; compinit to .zshrc

or run echo "autoload -Uz compinit; compinit" >> .zshrc in your shell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!