Docker Community Forums

Share and learn in the Docker community.

Unable to run "docker info" inside WSL 2 docker-desktop distro: right or wrong?

I’m running Windows 10 Pro update to 20H2 build 19042. I installed WSL 2 upgrade. I installed Docker for Windows version 2.4.0.0 (48506). No additional distros installed.

Is it normal that from within WSL 2 I can’t run docker (-sh: docker not found)?

I expected it to give the same results as from Windows.

TIA, FG

Yes, this is normal. “Inside WSL” means inside a specific Linux distro that you have installed from the app store. You have to install the docker cli to make this command available. Take a look at the installation docs for instructions for the distro you use. For example on Debian the package is called ‘docker-ce-cli’.

Thanks. That would deserve to be emphasized in the documentation. The Docker Desktop installation guide doesn’t mention the need to install a distro to fully exploit Docker Desktop.

They only speak of WSL2 as a backend where the images are stored and where the containers run. You can do all the Docker related stuff in PowerShell, you find no limits there. You have to install a Linux distro to use WSL2, not to use Docker (that’s what I’m doing, I do most of my work in Debian).

Your Windows build number: 10.0.18932.1000
Ubuntu 18.04
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
For Windows 10 FAST track until 10.0.18912.1000, I can use docker client in WSL 1 with Docker Desktop 18.01 - 18.09 simply through two configurations.
In Docker Desktop:
check “Expose daemon on tcp://localhost:2375 without TLS”
In WSL 1:
export DOCKER_HOST=tcp://0.0.0.0:2375
After upgraded to the build 18932 and WSL 2, docker client in WSL won’t connect to Docker Desktop engine. Sample error.

$ docker image ls
Cannot connect to the Docker daemon at tcp://0.0.0.0:2375. Is the docker daemon running?
Still, the windows cmd side, docker client works as expected.

$ docker image ls
REPOSITORY TAG IMAGE ID CREATED
SIZE
dregistry.corp.xxxx.com:5443/de/nukl-bamboo v1 13cac1c2e659 2 weeks ago
3.47GB
dregistry.corp.xxxx.com:5443/de/nukl-bamboo latest 6378579fd96c 5 weeks ago
730MB
dregistry.corp.xxxx.com:5443/de/rgp-bamboo latest 43e7c044a2e3 6 weeks ago
4.03GB
dregistry.corp.xxxx.com:5443/de/liteon723 latest b8aa4d6c5888 8 weeks ago
2.04GB
dregistry.corp.xxxx.com:5443/de/bezeq-dev latest 0ac9e2c171ff 2 months ago
2.1GB
ubuntu xenial a3551444fc85 2 months ago
119MB
dregistry.corp.xxxx.com:5443/de/nukl-build a59151f7cb8b 2 months ago
716MB
dregistry.corp.xxxx.com:5443/de/smart-gateway-build latest 52b2485d5a31 6 months ago
456MB