Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running docker on Ubuntu 18.04.2 LTS (WSL Enabled) #4385

Closed
Kundan22 opened this issue Aug 7, 2019 · 25 comments
Closed

Running docker on Ubuntu 18.04.2 LTS (WSL Enabled) #4385

Kundan22 opened this issue Aug 7, 2019 · 25 comments

Comments

@Kundan22
Copy link

Kundan22 commented Aug 7, 2019

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
@Drakota
Copy link

Drakota commented Aug 7, 2019

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

@Kundan22
Copy link
Author

Kundan22 commented Aug 7, 2019

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)

@Drakota
Copy link

Drakota commented Aug 7, 2019

Can you press Win Key + R, write winver and share a screenshot?

@Kundan22
Copy link
Author

Kundan22 commented Aug 7, 2019

image

is there any other way to check if which version WSL2 or WSL1 is installed?

@Kundan22
Copy link
Author

Kundan22 commented Aug 7, 2019

~$ 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:https:///var/run/docker.sock. Is the docker daemon running?

@Drakota
Copy link

Drakota commented Aug 7, 2019

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

@Kundan22
Copy link
Author

Kundan22 commented Aug 8, 2019

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.

@Drakota
Copy link

Drakota commented Aug 8, 2019

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.
image image

@lucasctd
Copy link

lucasctd commented Aug 8, 2019

Try build 18932, I am using this one and it works with the same commands you have used.

@Kundan22
Copy link
Author

Kundan22 commented Aug 8, 2019

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

@lucasctd
Copy link

lucasctd commented Aug 8, 2019

@Kundan22 yw. Keep in mind it may be slow if you access the windows file system as stated in #4387 and #4197

@lucasctd
Copy link

lucasctd commented Aug 8, 2019

I am downloading build 18956, if WSL2 performance is better on that one, I will post it here.

@craigloewen-msft
Copy link
Member

Closing this issue as the original problem is resolved. Thanks for filing!

@Kundan22
Copy link
Author

Kundan22 commented Aug 9, 2019

After upgrading to 18956 there is windows.old folder (~35 GB). Is it safe to delete it?

@lucasctd
Copy link

lucasctd commented Aug 9, 2019

Yes, but you will not be able to rollback to the build you were in case something gets wrong.

@abmruman
Copy link

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.

@spanyukov
Copy link

spanyukov commented Mar 24, 2020

I had similar issue. Now I have working solution for windows 10 home.

  1. install wsl2 (become an insider)
  2. enable wsl2 features
  3. install docker for wsl2
  4. enjoy! You have docker in your linux terminal on wsl2.

https://docs.docker.com/docker-for-windows/wsl-tech-preview/

@zoidyzoidzoid
Copy link

@spanyukov Unfortunately that requires Microsoft Windows 10 Professional or Enterprise 64-bit.

@spanyukov
Copy link

spanyukov commented Apr 1, 2020

@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

@theAkito
Copy link

theAkito commented Apr 1, 2020

Does anyone know when this will be available for non-insiders? I don't want to join the program just for WSL2...

@fatichar
Copy link

Docker on WSL2 has its own issues.
#4983

@theAkito
Copy link

@fatichar

I actually set up a new Windows 10 today and am working with WSL 2 + Docker right now. Working really good so far.

I've read the issue you linked and this is a "problem" with Docker, in general. The IPv6 thing is sometimes blocking stuff on real Linux, too. (I've experienced it.)

@MinsonLee
Copy link

~$ 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:https:///var/run/docker.sock. Is the docker daemon running?

I had a same problem, it made me crazy

@Graycat-Jia
Copy link

I also had the same problem, i want to know what you solve it

@Sinhraphathatron
Copy link

I also had the same problem, i want to know what you solve it

~$ 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:https:///var/run/docker.sock. Is the docker daemon running?

I had a same problem, it made me crazy

I have found solution in this thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests