Docker – Service Not Starting on New WSL2

dockerUbuntuwindowswindows-subsystem-for-linux

Im trying to start docker in the brand new WSL2 with the following command :

sudo service docker start

then:

sudo service docker status

result :
* Docker is running

BUT on running the test container with :

sudo docker run hello-world

Error:docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.

and the status now is
* Docker is not running

….
HERE's an example im trying to
emulate

MY ENVIRONMENT :

WINDOWS : WINDOWS 10 HOME,
VERSION : 1903,
OS build : 18362.239

DOCKER :
Docker version 18.09.7, build 2d0083d

i HAVE downloaded docker for ubuntu according to the :official website

In windows features i have WSL, Windows Hypervisor Platform, Virtual Machine Platform enabled here's a screenshot

screenshot

I dont have Hyper-V

I have been using WSL for general purpose proggraming for about 6 months now. Never got stuck this way

How can I run docker natively as promised by the latest WSL2??

Here's another screenshot

terminal

Best Answer

The error you are mentioning is present in WSL1.

Please cross check that your WSL2 is setup properly? It needs Windows 10 build 18917 or later.

If you Setup your WSL2 properly then you won’t have any issue running Docker on WSL2

Follow this link for WSL2 Setup -

https://www.thomasmaurer.ch/2019/06/install-wsl-2-on-windows-10/

Related Question