11

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

6
  • Warning Not everything works in WSL. Commented Jul 18, 2019 at 12:20
  • @ctrl-alt-delor can you look at the example I've included
    – cosmicsage
    Commented Jul 18, 2019 at 12:53
  • There are hundreds of issue with docker. Here is the popular one github.com/microsoft/WSL/issues/4165. tl;dr, wait and watch.
    – Biswapriyo
    Commented Jul 18, 2019 at 14:02
  • 1
    The sysVinit script works but not every networking aspects. systemd way requires heavy customization. In my opinion, WSL2 isn't a game changing thing, it's just a mixture of VM, container tech and some MS juice.
    – Biswapriyo
    Commented Jul 19, 2019 at 5:38
  • 1
    I'm on Windows 10 v2004, WSL 2 enabled, DD 2.3.0.3, all WSL 2 + Integration options enabled. I've reinstalled DD, rebooted and thought there was little left to do but blast my distro and try rebuilding it. THEN I found this post and apparently the missing step I needed was only sudo service docker start sigh
    – rainabba
    Commented Jun 4, 2020 at 17:13

2 Answers 2

2

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/

1
  • maybe you are right, but the article says windows 10 pro needed since wsl2 uses Hyper-V which is only available in windows better than windows Home which i currently have
    – cosmicsage
    Commented Aug 18, 2019 at 20:24
0

When I originally asked this question Docker for Wsl was implemented with Hyper-V & LinuxKit by the docker team. I didn't work for me because I had Windows 10 Home .

Now that the WSL 2 has been stably released, the answer to how to use docker on WSL is available on the Official Microsoft Docs:

https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-containers

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .