Remote-Containers Extension of VS Code not able to execute docker commands

Viewed 3520

Setup:

  • Ubuntu 20.04 distro running inside WSL2 (5.4.72-microsoft-standard-WSL2)
  • VS Code version 1.55.2 installed in Windows
  • Docker version 19.03.8, build afacb8b7f0 installed in WSL2
  • docker-compose version 1.29.0, build 07737305 installed in WSL2
  • Remote-Containers Extension for VS Code v0.166.1 installed locally (I could not find an option to explicitly install this inside WSL2, but I am not sure if this even matters, see below)

Original error:

When I open the command palette and enter Remote-Containers: Rebuild and Reopen in Container, I get the error `The 'docker' command was not found. Make sure Docker is installed' in a pop up window.

What I tried:

Attempt 1

First, I thought that the Remote-Containers extension wants to execute the docker commands inside windows and not WSL2. Since I don't have Docker Desktop installed on Windows, it is impossible to execute docker commands in Windows. So I tried downloading a specific version of the the Remote-Containers extension file from the marketplace v0.165.0 I believe, copying it into the VS extension folder inside WSL2 /home/kevinsuedmersen/.vscode-server/extensions and installing it manually from the VS Code Extension panel. However, this also installed the Remote-Containers extension locally, so probably on Windows. I am not sure if locally means that this extension is available globally, but nevertheless, I am still getting the error that the docker command is not found as explained above.

Attempt 2

I notice that when I open a PowerShell on Windows, I can use the docker daemon inside WSL2 by prepending wsl to all docker commands, e.g. wsl docker run hello-world. So, I went to the VS Code and in settings (Settings > Remote > Containers > Docker Path), I changed the docker path from docker to wsl docker, but then, I got this error Docker Desktop WSL 2 backend required. This is even the case on another laptop, where I actually have Docker Desktop installed and the WSL2 backend enabled.

Attempt 3

I tried changing the docker path in VS code to the full path of the docker socket in WSL2 /var/run/docker.sock, but then I got the error Current user does not have permission to run 'docker'. Try adding the user to the 'docker' group. My current user kevinsuedmersen is already member of the docker group.

Any advice or directions are greatly appreciated.

1 Answers
Related