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

WSL2 integration not working after enabling #7039

Closed
2 tasks done
mchobbylong opened this issue Jun 3, 2020 · 22 comments
Closed
2 tasks done

WSL2 integration not working after enabling #7039

mchobbylong opened this issue Jun 3, 2020 · 22 comments

Comments

@mchobbylong
Copy link

  • I have tried with the latest version of my channel (Stable or Edge)
  • I have uploaded Diagnostics
  • Diagnostics ID: B42B54C8-4B54-4F35-B87C-9D27222F0C9C/20200603141639

Expected behavior

The docker command in my WSL2 Ubuntu distro should work.

Actual behavior

Type docker into the shell, then get the not found error:

The command 'docker' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop settings.

See https://docs.docker.com/docker-for-windows/wsl/ for details.

Information

  • Windows Version: 10.0.19041.264
  • Docker Desktop Version: 2.3.0.3 (Stable)
  • Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: No

Steps to reproduce the behavior

  1. Install Docker Desktop via the official exe installer
  2. Check that Enable integration with my default WSL distro switch is checked
  3. Open a Windows Terminal shell, open a tab for WSL2 Ubuntu-18.04 shell, and type docker.
@StefanScherer
Copy link
Member

When you run docker in a distro where the integration isn‘t fully finished the fallback script is found in PATH that gives you this message.

Once the integration is finished if you still see this message please run hash -r in Ubuntu. Afterwards the docker binary is called.

This also can happen directly after logging in to Windows and open the Ubuntu terminal before Docker Desktop has started.

@mchobbylong
Copy link
Author

@StefanScherer Thanks for your quick response.

That is not the case I am experiencing since I am sure that Docker Desktop itself is fully started before I enter the WSL2 shell. In fact, executing hash -r does not solve my problem.

However, one thing worth to mention is that a process com.docker.wsl-distro-proxy.exe is continually starting and dying in the host Win10. I can see this in the Task Manager.

The corresponding piece (I think) in the logfile is:

[00:08:45.888][WslIntegrationAgent-Ubuntu-18.04][Info   ] time="2020-06-04T00:08:47+08:00" level=fatal msg="open /run/docker-desktop-proxy.pid: permission denied"
[00:08:45.958][WslIntegrationAgent-Ubuntu-18.04][Info   ] 2020/06/04 00:08:45 Proxy error: exit status 1

And these two lines repeat again and again in the logfile.

@mchobbylong
Copy link
Author

Okay, I just found that the problem comes from a fake-bash I set as the default shell of root. This actually makes the integration process failed to execute the commands with root privilege. This issue is now solved.

@grebnetiew
Copy link

I had the same problem, and (tentatively) attribute it to having set zsh as the shell for root.

I do think docker should be able to deal with 'nonstandard' configurations, or at least give some semblance of an error message if it finds a situation it can not deal with.

@mchobbylong
Copy link
Author

@grebnetiew Seems that docker is only adapted to bash as the default shell. And it is noteworthy that invoking zsh by zsh -c will have a different behavior compared to bash (see here), which may be the reason why docker's integration process fails.

@lackovic
Copy link

I am having the same issue on ArchWSL, logged in as non-root user belonging to the wheel group (%wheel ALL=(ALL) ALL in visudo).

Any idea how I could solve/troubleshoot it?

Using bash:

$ ps -p $$
PID TTY          TIME CMD
  8 pts/0    00:00:00 bash

Docker is running and WSL 2 is enabled:

2020-06-30_140643

Windows 10 version 2004 build 19041.329
Docker Desktop Version: 2.3.0.3 (Stable)

@lackovic
Copy link

Any idea how I could solve/troubleshoot it?

Uninstalling and re-installing Docker Desktop has fixed the issue.

Went through the documentation again an noticed the sentence Ensure you have completed the steps described in the Prerequisites section before installing the Docker Desktop Stable 2.3.0.2 release. I suspect I had previously installed Docker Desktop before WSL 2.

@chiptus
Copy link

chiptus commented Jul 26, 2020

Okay, I just found that the problem comes from a fake-bash I set as the default shell of root. This actually makes the integration process failed to execute the commands with root privilege. This issue is now solved.

I have the same problem. I don't see a service that is terminating. Where is that logfile you mentioned? How do I know which is the default shell for root? Mine was zsh and I changed to bash using chsh -s $(which bash)

@mchobbylong
Copy link
Author

@chiptus

Where is that logfile you mentioned?

Right-click Docker's tray icon then click "Troubleshoot". This will generate the logfile.

How do I know which is the default shell for root?

It is in file /etc/passwd.

The good news is that a new Stable version is released and the developer group claimed this issue is properly fixed (related issue: #7653). You should give it a try :-)

@chiptus
Copy link

chiptus commented Jul 28, 2020 via email

@chiptus
Copy link

chiptus commented Jul 29, 2020

and it's back again 👎

@chiptus
Copy link

chiptus commented Jul 29, 2020

I have the following logs:

[13:05:04.261][WslIntegrationAgent-Ubuntu-20.04][Info   ] /bin/bash: /mnt/wsl/docker-desktop/docker-desktop-proxy: Permission denied
[13:05:04.317][WslIntegrationAgent-Ubuntu-20.04][Info   ] 2020/07/29 13:05:04 Proxy error: exit status 126
[13:05:05.706][WslIntegrationAgent-Ubuntu][Info   ] 2020/07/29 13:05:05 unable to create ~/.docker directory: exit status 4294967295
[13:05:08.067][WslIntegrationAgent-Ubuntu-20.04][Info   ] /bin/bash: /mnt/wsl/docker-desktop/docker-desktop-proxy: Permission denied
[13:05:08.141][WslIntegrationAgent-Ubuntu-20.04][Info   ] 2020/07/29 13:05:08 Proxy error: exit status 126
[13:05:09.459][WslIntegrationAgent-Ubuntu][Info   ] 2020/07/29 13:05:09 unable to create ~/.docker directory: exit status 4294967295
[13:05:11.921][WslIntegrationAgent-Ubuntu-20.04][Info   ] /bin/bash: /mnt/wsl/docker-desktop/docker-desktop-proxy: Permission denied
[13:05:11.984][WslIntegrationAgent-Ubuntu-20.04][Info   ] 2020/07/29 13:05:11 Proxy error: exit status 126
[13:05:12.222][WslIntegrationAgent-Ubuntu][Info   ] 2020/07/29 13:05:12 unable to create ~/.docker directory: exit status 4294967295

root default shell is /bin/bash

@alfonso-rb
Copy link

This happened to me. I had to uninstall and reinstall docker desktop. I rebooted in between for good measure. I wouldn't be surprised if it happens again...

@samuk190
Copy link

Don't need to reinstall it.

Open windows shell as admin
wsl --unregister docker-desktop

then go to services, stop docker desktop service

restart and voila

@Falx
Copy link

Falx commented Aug 27, 2020

While this solves it when it happens (issuing wsl --unregister ubuntu, then restarting everything). I was able to reproduce the issue every time I issue the following command: docker rm -f [containername].

I am running

  • Docker Desktop 2.3.0.4 (46911) stable
  • Engine: 19.03.12
  • On WSL2 (using Ubuntu)

@zxibang
Copy link

zxibang commented Sep 2, 2020

It might be the WSL2 Ubuntu isn't the default subsystem.
I solved this problem by:

  1. windows shell cmd run: wsl --unregister docker-desktop
  2. go to services, stop docker desktop service
  3. windows shell cmd run: wslconfig /s Ubuntu-16.04 #Ubuntu-16.04 is my wsl2 ubuntu's name
  4. checkout is it the default subsystem: wsl --list
  5. open docker desktop APP, then open ubuntu and run docker command.

@xe-nvdk
Copy link

xe-nvdk commented Sep 3, 2020

While this solves it when it happens (issuing wsl --unregister ubuntu, then restarting everything). I was able to reproduce the issue every time I issue the following command: docker rm -f [containername].

I am running

  • Docker Desktop 2.3.0.4 (46911) stable
  • Engine: 19.03.12
  • On WSL2 (using Ubuntu)

Happens to me too. Same scenario.

@parkan
Copy link

parkan commented Sep 3, 2020

you can also check whether the integration is enabled for a specific system under Settings -> Resources -> WSL INTEGRATION (separate from the "Use the WSL2 Engine" setting in General) and enable it as needed

@spicylentils
Copy link

Confirm Docker for Windows is running. It wasn't for me. After Docker for Windows is running, execute hash -r. docker now runs in WSL2.

@gphorvath
Copy link

Don't need to reinstall it.

Open windows shell as admin
wsl --unregister docker-desktop

then go to services, stop docker desktop service

restart and voila

This helped me!

@adi-mohan
Copy link

Don't need to reinstall it.

Open windows shell as admin
wsl --unregister docker-desktop

then go to services, stop docker desktop service

restart and voila

This worked for me!

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Nov 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests