Why does it tell me this: "Docker is not running."?

I am learning to use Docker and I am trying to create a new project with laravel. So I installed Ubuntu with WSL, then i run Ubuntu with wsl -d Ubuntu, everything worked fine but then, but when I typed the following command: curl -s https://laravel.build/example-app | bash, Powershell gave me this message: Docker is not running.

My problem is that I actually have Docker running.

Please let us know which docker version you are trying to use

  • Docker Desktop installed in Windows with enabled integration for the Ubuntu distribution
  • Docker-CE installed using the Ubuntu packages from the docker ubuntu repository.

Thanks for the answer, I have Docker Desktop installed in windows. But without enabled integration for the Ubuntu distribution. Do you mean this?
image

At least it is variation 1.

Assumed you have no other WSL2 Distribution, the Ubuntu should already be the default WSL2 distribution, and the docker client should have been available inside the distro.

It takes a while after starting a distribution until the docker cli is usable.
Whenever docker ps works, your command should work as well.

thank you very much for the clarification and your help, now is working.

Can you explain why it is working now, whether you had to change something or just wait longer?

It will help others that stumble across this topic, to not just see a problem and a conversation about it, but also find a solution or explanation about what made it finally work.

Sorry, of course. I think it had something to do with the integration enabled for the Ubuntu distribution. After you asked about the version I was using, I checked the Docker settings, went to resources, and made sure that the integration was enabled. It turned out that it was not enabled. So, after activating it.
image

I waited for a while and then I went back to PowerShell. I entered the Ubuntu environment and confirmed that the ‘docker ps’ command was functioning properly. It indeed worked without any issues. After that, I proceeded to type ‘curl -s https://laravel.build/P1 | bash’ and everything worked perfectly.

I apologize if the explanation is not very detailed. I am currently learning to use Docker…

1 Like

Thank you for sharing. I am sure it will help others that are in the same situation.

Note: You can run wsl --list to see which distro is set as default Distro. Depending whether Ubuntu is marked as default distro, the checkbox to enable integration with the default distro would be sufficient, if Ubuntu is not the default distro, then setting the toggle-switch to on indeed is necessary.

1 Like

Thanks for the information. I also hope that this can be helpful to others.