Running Docker Image on WSL - Ubuntu 18.04.5 LTS

I tried to run the demo image with below command

sudo docker run docker/whalesay cowsay Hello-world!"

And I am getting below response
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See ‘docker run --help’.

OS: I am using Ubuntu 18.04.5 LTS in Windows subsystem for Linux

I have below version of Docker installed
image

Can someone help me with this issue ?

  • Do you have WSL, or WSL2?
  • Did you install Docker Desktop and allow it to also install the WSL2 components?
  • Is Docker Desktop actually running?
  • (if you are using a non-default distro) Did you go into Resources in the Docker Desktop configuration and make sure that WSL2 integration is explicitly enabled for your WSL2 distro?

I just did everything in the list above, and I went from “not working” (1st attempt, error message) to “working” (2nd attempt)

You probably still have to start the docker service. Can you run sudo systemctl start docker and try again?

Dear @venkateshmg.

Kindly check what @HerrSubset mentioned and feed us back.