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

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

Closed
mwoodpatrick opened this issue Nov 7, 2019 · 103 comments

Comments

@mwoodpatrick
Copy link

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

@zeehjr
Copy link

zeehjr commented Nov 7, 2019

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

@liyo
Copy link

liyo commented Nov 7, 2019

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

liyo commented Nov 7, 2019

Fixed it by switching to Linux containers...

@mwoodpatrick
Copy link
Author

mwoodpatrick commented Nov 8, 2019 via email

@simonferquel
Copy link

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

@mwoodpatrick
Copy link
Author

mwoodpatrick commented Nov 8, 2019 via email

@mikedickey
Copy link

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?

@simonferquel
Copy link

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 ?

@mwoodpatrick
Copy link
Author

mwoodpatrick commented Nov 12, 2019 via email

@stewartadam
Copy link

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.

@HawkiesZA
Copy link

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.

@ilerik
Copy link

ilerik commented Dec 4, 2019

@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!

@luck02
Copy link

luck02 commented Dec 13, 2019

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>

@flipch
Copy link

flipch commented Dec 13, 2019

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?

@luck02
Copy link

luck02 commented Dec 13, 2019

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.

@ldormoy
Copy link

ldormoy commented Dec 16, 2019

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

@snapfreeze
Copy link

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.

@daneel3001
Copy link

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

@ldormoy
Copy link

ldormoy commented Dec 22, 2019

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.

@luck02
Copy link

luck02 commented Dec 23, 2019

#5096 (comment)

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.

@ankitjena
Copy link

ankitjena commented Jan 6, 2020

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

Which settings? I am using docker cli in WSL

@jaimergp
Copy link

jaimergp commented Jan 7, 2020

@ankitjena Click on Docker's tray icon. Then navigate to Settings> Resources> WSL Integration.

@delusive
Copy link

delusive commented Jan 9, 2020

Just a heads up for anyone having this issue and everything here has been checked out.

I realized that docker-desktop-proxy process wasn't running inside the distribution (ps aux | grep docker-desktop-proxy).

I tried to start it manually with the following command (copied from a working system):

sudo /mnt/wsl/docker-desktop/docker-desktop-proxy --distro-name Ubuntu --docker-desktop-root /mnt/wsl/docker-desktop

When I ran this I got the following error:

FATA[0000] open /mnt/wsl/docker-desktop-bind-mounts/Ubuntu/780bef17cf3a89fb203c54a75bff8f6fc2d93d444b904ef0cf4c5e4fcacd73ac: is a directory

So I went into Settings -> Resources -> WSL Integration and turned it off for the distribution not working.

Then I removed that docker-desktop-bind-mounts directory.

Flipped back on the WSL Integration for the distribution and bang it works.

Hope this helps anyone else.

Cheers.

@simonferquel
Copy link

Thanks for the workaround. I should be able to use that for fixing the underlying issue.

@altwohill
Copy link

I'm finding that docker turns off the WSL integration every now and again. It also looses my sign-in information. All the other settings seem to stay in place

@nielswart
Copy link

I'm running Docker Desktop 2.2.0 and I'm unable to run docker on my wsl distro without sudo.

image

Also note that:
docker context ls only shows a single context as explained here #4361 (comment) - hope that helps

@altwohill
Copy link

I'm running Docker Desktop 2.2.0 and I'm unable to run docker on my wsl distro without sudo.

You need to follow the instructions here https://docs.docker.com/install/linux/linux-postinstall/

@simonferquel
Copy link

@nielswart there is not "docker_wsl" context anymore. Also, you seem to have your DOCKER_HOST environment variable set to tcp://loclhost:23750. You need to unset it to work with docker-desktop.

@npujcong
Copy link

I solve my probolem with https://docs.docker.com/docker-for-windows/wsl/

@PavelSosin-320
Copy link

I have perfectly working WSL2 Ubuntu 20.04 with all additions provided by Ubuntu developers like systemd enablement. Maybe, the problem is that Ubuntu 20.04 works too well? They are ahead in the CNCF rase but RedHat is closing the gap.

@AbelHu
Copy link

AbelHu commented Nov 24, 2020

Thanks @pneborg. It works for me after below changes.

  • In WSL2:
    sudo apt update
    sudo apt upgrade
    unset DOCKER_HOST
    sudo /etc/init.d/docker restart

  • In PowerShell:
    wsl.exe -l -v
    NAME STATE VERSION
    * Ubuntu Running 2
    docker-desktop Running 2
    docker-desktop-data Running 2

  • In docker Settings with using Linux container:
    image
    image

@milesrae4
Copy link

milesrae4 commented Nov 24, 2020

I'm running Docker Desktop 2.2.0 and I'm unable to run docker on my wsl distro without sudo.

image

Also note that:
docker context ls only shows a single context as explained here #4361 (comment) - hope that helps

I experienced the same problem and even after going through the following instructions: https://docs.docker.com/engine/install/linux-postinstall/ , still did not allow me to execute docker commands without sudo.
However if i run "unset DOCKER_HOST" each time the bash terminal opens, it seems to allow me to to run docker without sudo. I checked my .bashrc file and i dont have an existing DOCKER_HOST variable being set in there as other people are saying to comment it out, but i cant seem to find where its being set.
The work around i found was to add the following lines to my ~/.bashrc file

echo "Removing DOCKER_HOST "
unset DOCKET_HOST

There probably is a better solution than this, but it worked for me in the meantime. This will then unset the DOCKER_HOST variable each time a bash terminal is opened.

@X-Infinite
Copy link

I had the same problem with WSL 2 on debian 10 (without docker desktop). Checking the docker daemon log, the problem seemed from iptables:

time="2020-08-30T18:23:54.858343900+02:00" level=warning msg="Running iptables --wait -t nat -L -n failed with message: iptables v1.8.2 (nf_tables): CHAIN_ADD failed (No such file or directory): chain PREROUTING, error: exit status 4"

So, I changed iptables to legacy mode:

sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

Now, It work fine:

$ sudo service docker restart
$ sudo service docker status
[ ok ] Docker is running.

Hope it helps people with the same problem.

I use this way,it's works!!!!!!

@williscool
Copy link

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

this fixed it for me too... but I had to kill and restart my tmux for it to pick whatever that does up o.o

@mnpenner
Copy link

mnpenner commented Apr 11, 2021

I don't know what's going on here, but Docker Desktop broke my Kubernetes install again. Every time I upgrade, it breaks something.

First it deactivated Kubernetes integration, so I had to re-enable that:

image

WSL integration was still enabled, but make sure that's checked too:

image

docker ps still wouldn't connect from inside WSL though until I checked this:

image

I don't recall if I had that checked or not before, but it stopped working one way or another, or perhaps that's due to the next issue...

I think when Docker Desktop uninstalled Kubernetes by itself, it killed the certificates along with it. So I was also getting errors like this:

Unable to connect to the server: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "kubernetes")

So from PowerShell (Windows side) I ran:

cat ~/.kube/config

And then manually copied the docker-desktop cluster and user over into ~/.kube/config inside WSL.

N.B. I have my $DOCKER_HOST set to...

❯ echo $DOCKER_HOST
tcp://0.0.0.0:2375

Which I set awhile back I think because of some WSL networking shenanigans.

Of course it also lost or destroyed all my volumes so now all my test data is gone and my database won't boot.

@btshowmetainfo
Copy link

Same problem here. Suddenly, since some recent upgrade, the integration with my Ubuntu 20.04 distro (which IS my default distro...) broke, and I had to manually re-enable it...

@PK2W
Copy link

PK2W commented May 3, 2021

I managed to get docker using WSL2 with Ubuntu 2004 distro right away by following docker desktop documentation, however, I had to use SLES distro for one of my projects and it didn't work - docker wsl2 integration component refused to come up. Docker Desktop threw the following message:
image

And within SLES I was getting:

root@sles12sp5:~ # docker version
Client: Docker Engine - Community
 Cloud integration: 1.0.12
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:17:50 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

So I followed the workaround provided in this message and managed to make it working by just starting the docker-desktop-proxy process. as was mentioned in the original workaround message I copied exec string from working ubuntu setup:

root@ubuntu2004:~ # ps -aux | grep docker-desktop
root       705  0.0  0.1 1390388 30300 pts/1   Ssl+ 23:16   0:00 /mnt/wsl/docker-desktop/docker-desktop-proxy --distro-name Ubuntu-20.04 --docker-desktop-root /mnt/wsl/docker-desktop
root@sles12sp5:~ # docker version
Client: Docker Engine - Community
 Cloud integration: 1.0.12
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:17:50 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
root@sles12sp5:~ # /mnt/wsl/docker-desktop/docker-desktop-proxy --distro-name Ubuntu-20.04 --docker-desktop-root /mnt/wsl/docker-desktop &>/dev/null &
[1] 4535
root@sles12sp5:~ # docker version
Client: Docker Engine - Community
 Cloud integration: 1.0.12
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:17:50 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:15:47 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
root@sles12sp5:~ #

Note that I copy-pasted the exact same exec string from ubuntu, i.e. keeping --distro-name Ubuntu-20.04 parameter untouched , if I try to provide SLES distro name instead, script fails with:

root@sles12sp5:~ # /mnt/wsl/docker-desktop/docker-desktop-proxy --distro-name SUSE-Linux-Enterprise-Server-12-SP5 --docker-desktop-root /mnt/wsl/dcker-desktop
INFO[0000] populating cli tools from /mnt/wsl/docker-desktop/cli-tools
...
INFO[0000] creating symlink for /usr/share/zsh/vendor-completions/_docker
INFO[0000] cli tools successfully installed
FATA[0000] creating cross distro service socket: listen unix /mnt/wsl/docker-desktop/shared-sockets/guest-services/distro-services/suse-linux-enterpriseserver-12-sp5.sock: bind: invalid argument

@r2DoesInc
Copy link

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

To be clear, run these commands in your linux container that is having issues. Then from Windows restart the whole Docker service. not just the app. Right click the icon in your tray and restart. I think for me this was an issue bcause my container was originally a v1 container and the migration doesnt do a good enough job at cleanup.

Thank you @williscool !

@rmourey26
Copy link

Just a heads up for anyone having this issue and everything here has been checked out.

I realized that docker-desktop-proxy process wasn't running inside the distribution (ps aux | grep docker-desktop-proxy).

I tried to start it manually with the following command (copied from a working system):

sudo /mnt/wsl/docker-desktop/docker-desktop-proxy --distro-name Ubuntu --docker-desktop-root /mnt/wsl/docker-desktop

When I ran this I got the following error:

FATA[0000] open /mnt/wsl/docker-desktop-bind-mounts/Ubuntu/780bef17cf3a89fb203c54a75bff8f6fc2d93d444b904ef0cf4c5e4fcacd73ac: is a directory

So I went into Settings -> Resources -> WSL Integration and turned it off for the distribution not working.

Then I removed that docker-desktop-bind-mounts directory.

Flipped back on the WSL Integration for the distribution and bang it works.

Hope this helps anyone else.

Cheers.
I've had the same issue for months, and ultimately using
sudo /mnt/wsl/docker-desktop/docker-desktop-proxy --distro-name Ubuntu --docker-desktop-root /mnt/wsl/docker-desktop
upon opening the Ubuntu 20.04 Wsl2 Microsoft store app temporarily fixes the issue.

@pappel-ig
Copy link

getting the same error:
NAME DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
default * Current DOCKER_HOST based configuration tcp://localhost:2375 https://74.16.92.21:6443 (default) swarm
Warning: DOCKER_HOST environment variable overrides the active context. To use a context, either set the global --context flag, or unset DOCKER_HOST environment variable.

@zeromask1337
Copy link

I solved this problem by running sudo service docker start. Its because systemctl doesn't work on wsl and you have to use Sysvinit.

@muhammadsheraz
Copy link

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

This solution saved me, thanks a lot man!

@toreylittlefield
Copy link

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 thank you very much! I can confirm this solution worked for me.

@GavinRay97
Copy link

GavinRay97 commented Nov 22, 2021

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

Thank you so much! This fixed it for me as well:

  • Docker Desktop: 4.0.0 (67817)
  • Windows: Windows 11 Home Insider Preview 22483.1000, Feature Experience Pack 1000.22483.1000.0
  • WSL: Ubuntu 20.04

FWIW, this issue only popped up after explicitly enabling integration with Ubuntu in Docker Desktop settings.

Prior to that, I had only checked Default Distro because I thought that meant Ubuntu, but it did not. So I had been using it without the integration for some time.

@Muhannadimad
Copy link

Muhannadimad commented Jan 21, 2022

I am running wsl2 (Ubuntu-18.04) and I ran into the same issue.

I solved the problem using:
1- By default your ubuntu doesn't have 'docker engine', and to install it follow these steps: https://docs.docker.com/engine/install/ubuntu/ .

2- Start docker daemon using this command:
service docker start .

@timothydavis
Copy link

If you are trying to do this without docker desktop on Ubuntu. You can edit your /etc/docker/daemon.json and set the path to unix:///var/run/docker.sock this will make commands work inside of linux shell.

@ghost
Copy link

ghost commented Mar 25, 2022

upgrade wsl to wsl2 and restart docker desktop

@veysel-dtech
Copy link

If you are trying to do this without docker desktop on Ubuntu. You can edit your /etc/docker/daemon.json and set the path to unix:///var/run/docker.sock this will make commands work inside of linux shell.

@timothydavis thank you very much. this worked for me

@eccentricOrange
Copy link

eccentricOrange commented Jul 3, 2022

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

I am doing this, but it seems to reset after a reboot of Windows (shutdown /g as in CMD). I turned on integration yesterday, and it's off today morning. I did click "Apply", and some other settings (such as checking for updates in Docker Desktop) persist.

@docker-robott
Copy link
Collaborator

Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

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

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

/lifecycle locked

@docker docker locked and limited conversation to collaborators Nov 30, 2022
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