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.

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.