As described in this github discussion the issue arises when you mix several things together
- windows setup
- runs wsl / wsl2
- uses zsh as a shell on wsl
- installed docker desktop
In these situations you will the 'vendor completion' /usr/share/zsh/vendor-completions/_docker
because (supposedly)
the docker desktop install replaces it with a phony simlink
The solution described in this github discussion works, aka running
sudo rm -rf /usr/share/zsh/vendor-completions/_docker
and then
sudo cp /mnt/wsl/docker-desktop/cli-tools/usr/share/zsh/vendor-completions/_docker /usr/share/zsh/vendor-completions/
does work but only after one extra step
Installing Docker Desktop isn't enough to generate the true backend files at the location /mnt/wsl/docker-desktop/cli-tools/usr/share/zsh/vendor-completions/_docker
, you need to enable docker backend first as explained here
Only after this step will you be able to run the cp
command !
To make them non-writeable as mentionned in the OP :)