Docker will not start on wsl 2

I have been using Docker Desktop for one month since I installed it with my WSL 2 Ubuntu on a Windows 10 machine until this week.
First, I had an issue with starting the Docker Desktop software and then got an image that told me at the last resort to uninstall and reinstall the software which I did. When I reinstalled it, fortunately, all my images were intact and untouched.
On tuesday, I got a message that said “Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?” I spoke to my mentor about it and he said I should go to resources section in settings and activate the Ubuntu distro. The default distro option was initially activated. When I did so, docker ran on WSL 2 again.
But this morning, after launching my Docker Desktop, I got the same message again. I went to settings to check if what I activated has been deactivated.
First, in settings under General, the option “Use the WSL 2 based engine” is enabled. That’s okay.
Then under Resources > WSL integration, the option “enable integration with my default wsl distro” is enabled. also the option “enable integration with additional distros” is enabled.
So I don’t know what to do next. With these options enabled, I still get the message, “Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the Docker daemon running?”
What do I do next to start the Docker engine on WSL so I can use it? Thanks

Does the Docker client work from PowerShell? If you dont actually need a Linux client, you can just run docker from the Windows host. WSL integration just makes it available from a WSL distribution, but Docker will still run in the same virtual machine (called “docker-desktop”).

If the integration is enabled correctly, make sure you don’t install Docker inside that WSL distribution. Otherwise I can imagine that you somehow try to run an other Docker, but the docker daemon is not running inside the distribution.

This is just an idea, and I don’t have an other, so let’s hope it helps.

Docker is not installed inside WSL Ubuntu. I used Docker Desktop to integrate it.
I discovered that if I shutdown docker desktop and restart it, it starts working again.

1 Like

Restarting only the WSL distribution doesn’t solve it?

no, it doesn’t. sometimes, it hangs the wsl distro

What is the Ubuntu version in WSL? Can you try it with an other version? For example if you tried with Ubuntu 20.04, then can you try it with Ubuntu 22.04 or 18.04?

Whatever result you get, I recommend you to open an issue on GitHub

The integration should not stop automatically, but this is not something I could help you to fix.

@emekadavid
@rimelek

I was facing the same issue, this happens if the WSL Ubuntu distribution is running on version WSL 1 instead of version WSL 2. The existing ubuntu linux distro has to be upgraded to v2:

Have a glance on the step-by-step process provided in the attached screenshot to resolve this.

Here is the corresponding Docker documentation for WSL 2, please look at the section " Enabling Docker support in WSL 2 distros":

Thanks for sharing your solution! I’m surprised that the integration can be enabled for a v1 distro if it is not compatible, but that is also something that the developers can fix. .

1 Like

Thank you for the information. My problem has been solved."

Before, check this link: Installing Docker on Windows via WSL - Dataedo Documentation

If the issue is continue try to reinstall the Docker desktop.