Skip to content

Instantly share code, notes, and snippets.

@arnos-stuff
Created November 28, 2022 04:49
Show Gist options
  • Save arnos-stuff/d12f06623cf00183f4bf4f0beb0ac4e9 to your computer and use it in GitHub Desktop.
Save arnos-stuff/d12f06623cf00183f4bf4f0beb0ac4e9 to your computer and use it in GitHub Desktop.
Small tweak to the known fix to the vendor completion docker zsh wsl2 issue

The bug

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

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

The 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 !

Don't forget

To make them non-writeable as mentionned in the OP :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment