Docker Community Forums

Share and learn in the Docker community.

Unable to get zsh auto-completion working with Docker on Fedora 33

Hi everyone,

I cannot get auto-completion working for Docker commands with zsh.

With Bash, if I run docker images and double tab, I can see the list of images.

With Zsh, there is no auto-completion at all.

I even deleted the .zshrc and created a new one but the same issue occurs.

The auto-completion with zsh works fine with the system commands like cd , etc ,ls,…

I installed Fedora 33 from scratch with all the updates.

Then,I installed docker engine manually from the official doc Install Docker Engine on Fedora | Docker Documentation

I then installed the cli completion from following the instruction in Command-line completion | Docker Documentation

~/.zcompdump* have been removed.

echo $fpath

/home/marc/.zsh/completion /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions /usr/share/zsh/5.8/functions

cat ~/.zshrc
fpath=(~/.zsh/completion $fpath)
autoload -Uz compinit && compinit -i

logout and login again: same issue

Thank you for your help

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 reload the .zschrc file with the command source ~/.zshrc or restart the terminal - whichever works best for you. See this

Then see if it works.

1 Like

Hi,
I did it already but the issue is still there,even after a reboot.

SOLVED

For the ones you will get the same issue, first you need to add the file _docker from GitHub - felixr/docker-zsh-completion: zsh completion for docker as it has been explianed above but also you have to add these 2 lines below in . zshrc to enable the Docker commands with the zsh shell.

zstyle ':completion:*:*:docker:*' option-stacking yes

zstyle ':completion:*:*:docker-*:*' option-stacking yes