Running docker on Ubuntu 18.04.2 LTS (WSL Enabled)
Copied from Issue#468
tried running sudo /etc/init.d/docker start, it shows [Ok] but after that docker run command returns following
Please suggest
~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest fce289e99eb9 7 months ago 1.84kB
~$ sudo docker run hello-world
docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "process_linux.go:303: getting the final child's pid from pipe caused \"EOF\"": unknown.
ERRO[0002] error waiting for container: context canceled
Can you run wsl.exe -l -v and share the output? I suspect you're using the version 1.0 of WSL which does not work out of the box with Docker.
You should see something like this.
PS C:\Users\jbouchard> wsl.exe -l -v
NAME STATE VERSION
* Ubuntu Running 2
wsl.exe -l -v doesn't run on my terminal. it just shows how to run run command with options
but following command gives
$ wsl.exe --list
Windows Subsystem for Linux Distributions:
Ubuntu-18.04 (Default)
Can you press Win Key + R, write winver and share a screenshot?

is there any other way to check if which version WSL2 or WSL1 is installed?
~$ sudo /etc/init.d/docker start
[sudo] password for user:
* Starting Docker: docker [ OK ]
~$
when I ran the above command it shows [ OK ] but then
~$ sudo docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I'd suggest you install the Insider Preview build of Windows and follow this tutorial https://docs.microsoft.com/en-us/windows/wsl/wsl2-install
I tried on 3 different machines but every time I got the same result. on all machine wsl.exe -l -v doesn't return anything.. something is not correct.
Please note that you'll need to be running Windows 10 build 18917 or higher to use WSL 2
Have you done this step?
Follow the procedure to enroll in the Windows Insider Program and select the "Fast" ring updates.

Try build 18932, I am using this one and it works with the same commands you have used.
Alright!!! After following above step getting latest build and wasting 35gb of space...
and running below commands. WSL2 is running docker on ubuntu...
PS wsl --set-default-version 2
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
PS C:\WINDOWS\system32> wsl --set-version Ubuntu-18.04 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Conversion complete.
PS C:\WINDOWS\system32> wsl -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 2
Thanks for suggestions @Drakota & @lucasctd @mscraigloewen
@Kundan22 yw. Keep in mind it may be slow if you access the windows file system as stated in #4387 and #4197
I am downloading build 18956, if WSL2 performance is better on that one, I will post it here.
Closing this issue as the original problem is resolved. Thanks for filing!
After upgrading to 18956 there is windows.old folder (~35 GB). Is it safe to delete it?
Yes, but you will not be able to rollback to the build you were in case something gets wrong.
Some services like docker (standalone, ubuntu version, installed using bash) does not run even if you use sudo /etc/init.d/docker start or sudo service docker start or /etc/init.d/docker start. I updated from windows 1803 to 1903 (18362.592) today, then tried again, same results.
Then after wasting the whole day, it hits me! What you have to do is, run the linux subsystem as administrator by right clicking from start menu.
This will solve the issue and sudo service command will execute as it should, as a sudo user.
I had similar issue. Now I have working solution for windows 10 home.
- install wsl2 (become an insider)
- enable wsl2 features
- install docker for wsl2
- enjoy! You have docker in your linux terminal on wsl2.
https://docs.docker.com/docker-for-windows/wsl-tech-preview/
@spanyukov Unfortunately that requires Microsoft Windows 10 Professional or Enterprise 64-bit.
@spanyukov Unfortunately that requires Microsoft Windows 10 Professional or Enterprise 64-bit.
@zoidbergwill No, that is the best thing. I have my laptop on Windows 10 Home. Here is my current sys info: Edition: Windows 10 Home Insider Preview Single Language OS Build: 19592.1001
Does anyone know when this will be available for non-insiders? I don't want to join the program just for WSL2...