for-win icon indicating copy to clipboard operation
for-win copied to clipboard

ubuntu running under WSL2 not seeing Docker daemon at unix:///var/run/docker.sock

Open mwoodpatrick opened this issue 7 years ago • 103 comments

When running docker desktop version 2.1.5.0 (40323) on:

OS Name: Microsoft Windows 10 Pro OS Version: 10.0.19013 N/A Build 19013

Eben though WSL 2 based engine is enabled in Settings/General

docker container run hello-world on Ubuntu reports

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

mwoodpatrick avatar Nov 07 '19 19:11 mwoodpatrick

Which output do you see when running the following statement on powershell/cmd? docker context ls

Which output is returned when you run the follow statement on WSL terminal? docker ps

zeehjr avatar Nov 07 '19 19:11 zeehjr

Same issue here.

@zeehjr

C:\WINDOWS\system32>docker context ls
NAME                DESCRIPTION                               DOCKER ENDPOINT                  KUBERNETES ENDPOINT   ORCHESTRATOR
default             Current DOCKER_HOST based configuration   npipe:////./pipe/docker_engine                         swarm
wsl *               Docker daemon hosted in WSL 2             npipe:////./pipe/docker_wsl

and from Ubuntu WSL2 (only distro installed)

docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Strangely, the WSL Integration option is not available from Settings > Resources. WSL 2 based engine is enabled in Settings > General. Docker CLI is installed in Ubuntu.

liyo avatar Nov 07 '19 22:11 liyo

Fixed it by switching to Linux containers...

liyo avatar Nov 07 '19 23:11 liyo

I'm running with Linux containers and am seeing problem

in power shell

PS C:\WINDOWS\system32> docker context ls NAME DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR default * Current DOCKER_HOST based configuration npipe:////./pipe/docker_engine swarm wsl Docker daemon hosted in WSL 2 npipe:////./pipe/docker_wsl

In WSL 2 ubuntu shell

docker ps Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

On Thu, Nov 7, 2019 at 3:39 PM Pablo Wolochwianski [email protected] wrote:

Fixed it by switching to Linux containers...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/docker/for-win/issues/5096?email_source=notifications&email_token=AAQ6SQWJIKQKG2KOW7HB67LQSSRM3A5CNFSM4JKMAN3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDOGZFQ#issuecomment-551316630, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ6SQQONCXEHFKQNON3W6TQSSRM3ANCNFSM4JKMAN3A .

-- Mark Wood-Patrick

mwoodpatrick avatar Nov 08 '19 02:11 mwoodpatrick

@mwoodpatrick you need to go to the settings, and enable integration with your distro in "Resources -> WSL Integration".

simonferquel avatar Nov 08 '19 08:11 simonferquel

Many thanks that worked

On Fri, Nov 8, 2019 at 12:02 AM Simon Ferquel [email protected] wrote:

@mwoodpatrick https://github.com/mwoodpatrick you need to go to the settings, and enable integration with your distro in "Resources -> WSL Integration".

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/docker/for-win/issues/5096?email_source=notifications&email_token=AAQ6SQULY6OFOLPGZ4CZT5DQSUMJ3A5CNFSM4JKMAN3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDPBSGY#issuecomment-551426331, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ6SQSKF43N7HNUV4OW4LTQSUMJ3ANCNFSM4JKMAN3A .

-- Mark Wood-Patrick

mwoodpatrick avatar Nov 08 '19 12:11 mwoodpatrick

Ran into same problem, and resolved via "Resources -> WSL Integration"

This isn't clear anywhere, so I'd suggest adding a popup or something when you "Enable the Experimental WSL 2 Engine." Perhaps it should prompt you for list of distros you want to enable after you turn it on?

mikedickey avatar Nov 10 '19 21:11 mikedickey

Thanks for those feedback. I understand that this new behavior causes issues. We are giving some thoughts at always enabling integration with the default WSL distro. Would it make things better ?

simonferquel avatar Nov 12 '19 08:11 simonferquel

That would work for me, or perhaps a dialog box at startup showing which distros are enabled and ability to modify that would be better, perhaps with an option not to show this dialog at startup in future

On Tue, Nov 12, 2019 at 12:57 AM Simon Ferquel [email protected] wrote:

Thanks for those feedback. I understand that this new behavior causes issues. We are giving some thoughts at always enabling integration with the default WSL distro. Would it make things better ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/docker/for-win/issues/5096?email_source=notifications&email_token=AAQ6SQU7FG737QKO3AZBLKDQTJVYLA5CNFSM4JKMAN3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDZQLIY#issuecomment-552797603, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ6SQSVNJSL77RB5S4XN2TQTJVYLANCNFSM4JKMAN3A .

-- Mark Wood-Patrick

mwoodpatrick avatar Nov 12 '19 12:11 mwoodpatrick

A simple note under the Enable the WSL 2 based engine heading (as there is already in light grey) noting the requirement to also configure distros, along with a hyperlink/button to jump there would be more than sufficient.

stewartadam avatar Nov 13 '19 22:11 stewartadam

Having something pop up in General settings telling you which distros are enabled (and maybe warning you that none are currently active) would be helpful.

HawkiesZA avatar Nov 19 '19 12:11 HawkiesZA

@mwoodpatrick you need to go to the settings, and enable integration with your distro in "Resources -> WSL Integration".

Thanks a lot! Never thought of such a possibility!

ilerik avatar Dec 04 '19 11:12 ilerik

I can't seem to get the WSL context:

PS C:\WINDOWS\system32> docker context ls
NAME                DESCRIPTION                               DOCKER ENDPOINT                  KUBERNETES ENDPOINT   ORCHESTRATOR
default *           Current DOCKER_HOST based configuration   npipe:////./pipe/docker_engine                         swarm
PS C:\WINDOWS\system32>

I've enabled wsl 2 for my ubuntu machine. But in ubuntu terminal I get:

 13:00:41  gary@GaryLaptop  ~ 
$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I'm on docker desktop 2.1.7.0 (41536)

Output from PS wsl -l -v

PS C:\WINDOWS\system32> wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu-18.04           Running         2
  docker-desktop-data    Running         2
  docker-desktop         Running         2
PS C:\WINDOWS\system32>

luck02 avatar Dec 13 '19 21:12 luck02

I can't seem to get WSL 2 to connect with Docker.

From powershell image

From WSL 2 Debian image

Docker version image

Docker Resources > WSL Integration image

Am I missing something?

flipch avatar Dec 13 '19 21:12 flipch

One update, when I check the docker logs I do see this:

[13:07:57.685][WslIntegrationAgent-Ubuntu-18.04][Info   ] time="2019-12-13T13:07:57-08:00" level=fatal msg="unable to populate CLI tools: symlink /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker-compose /usr/bin/docker-compose: file exists"
[13:07:57.747][WslIntegrationAgent-Ubuntu-18.04][Info   ] 2019/12/13 13:07:57 Proxy error: exit status 1

Which is presumably cruft leftover from my WSL 1 based ubuntu instance.

luck02 avatar Dec 13 '19 22:12 luck02

I ran into the same issue.

I had to delete all WSL broken symbolic links previously created by Docker Desktop. Reinstalling Docker Desktop was not enough.

Here are the commands I ran to achieve that:

sudo find /usr -name "*docker*" -type l -exec rm {} +
sudo find /usr -name "*Docker*" -type l -exec rm {} +
sudo find /usr -name "*kube*" -type l -exec rm {} +
sudo rm /usr/share/doc/docker-ce-cli/changelog.Debian.gz

Then I restarted docker desktop and it worked again:

powershell$ docker context ls
NAME                DESCRIPTION                               DOCKER ENDPOINT                  KUBERNETES ENDPOINT   ORCHESTRATOR
default *           Current DOCKER_HOST based configuration   npipe:////./pipe/docker_engine                         swarm

wsl$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS          NAMES

Docker Desktop: 2.1.7.0-edge Windows: 10.0.19041.1 WSL 2: Ubuntu 18.04

ldormoy avatar Dec 16 '19 16:12 ldormoy

I can't seem to get WSL 2 to connect with Docker.

From powershell image

From WSL 2 Debian image

Docker version image

Docker Resources > WSL Integration image

Am I missing something?

Having the same issue. There's no wsl context after enabling the WSL 2 experimental features, and I can't access docker from inside the wsl.

snapfreeze avatar Dec 17 '19 11:12 snapfreeze

Hello

I seem to have the same issue. Docker Desktop: 2.1.7.0-edge Windows: 10.0.19041.1 WSL 2: Ubuntu 18.04

Reinstalled DD and reenabled WSL2 integration still didn't create the WSL context. Can anyone provide trusted installation steps for getting this working ?

@ldormoy : As you didn't have WSL context enabled and now have it, can you explain all steps you did take in addition to the commands you shared?

FYI, in Ubuntu having uninstalled Docker Desktop am having this:

 daniel  ~  docker version
Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea838
 Built:             Wed Nov 13 07:29:52 2019
 OS/Arch:           linux/amd64
 Experimental:      false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Thanks

daneel3001 avatar Dec 21 '19 21:12 daneel3001

As you didn't have WSL context enabled and now have it, can you explain all steps you did take in addition to the commands you shared?

Well that's the thing, I don't have it but it still works. I don't know whether this WSL context is a legacy feature from WSL 1, but in my case all I did was to check the docker logfile (it is available if you start a troubleshooting session) and delete the broken symbolic links until the logs are clean.

ldormoy avatar Dec 22 '19 12:12 ldormoy

https://github.com/docker/for-win/issues/5096#issuecomment-565633357

After I deleted the docker cruft from my original install everything worked. In my case I think I also found I had serious issues with my zsh config so I just blew away my ubuntu and started fresh. Worked fine after that, still no second WSL context, not sure what that all means though.

luck02 avatar Dec 23 '19 01:12 luck02