Docker Community Forums

Share and learn in the Docker community.

WSL and Docker for Windows: "Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?"

Well, I’ve been trying to troubleshoot this for the past 3 hours and haven’t gotten anywhere.

I’m throwing in the towel. I’ll just stick to doing everything in the Windows command line for now.

So far as I can tell, the daemon isn’t listening on port 2375 even though I have the option enabled in settings. I ran netstat -an | find /i "listening" in cmd to show all actively listening ports and there isn’t anything listening on 2375.

No matter what I do, docker in wsl cannot reach the daemon.

I’ve the same problem! any solution? I tried netstat and I found nothing listening to 2375, I also tried to connect it the daemon from the host as follows and it is not working

PS C:\> docker -H tcp://localhost:2375 ps
error during connect: Get http://localhost:2375/v1.39/containers/json: dial tcp [::1]:2375: connectex: No connection could be made because the target machine actively refused it.

Anyone has solution? I also tried to add an inbound rule for 2375 port but it still get the same error. Wondering if this version is buggy on this. Anyone know how to roll it back?

I never found a solution for this. @gnchen I’m thinking it might a bug in the current version, but I’m not so sure.

@acr1 After 2 days of struggling with corp IT, 2 thing block it. Firewall and Antivirus software. Need to give up at the end and go back to linux vm instead. I will recommend you also checking with your IT team

I’m doing a personal project, so no corporate IT or firewalls/AV should be blocking anything as far as I know. Windows Firewall/Defender doesn’t seem to be the problem from what I can see, but I could be wrong.

After trying various “solutions” from forwarding the Docker for Windows pipe to setting up my own docker machine, I finally found a solution that easily allows me to expose the docker daemon on a configurable port:

Simply run the following container to forward the docker daemon to a local port yourself.

docker run -d --restart=always -p -v /var/run/docker.sock:/var/run/docker.sock  alpine/socat  tcp-listen:2375,fork,reuseaddr unix-connect:/var/run/docker.sock

I use 23750 and therefore I’ve configured export DOCKER_HOST=tcp:// in my .bashrc in WSL.

Hope that helps…



Which stated:
echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc && source ~/.bashrc


You sir, are a gentleman and a scholar! Thank you!

This is the responsed for me

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See ‘docker run --help’.

I am having the same problems I have tried following this comments but still having the same error.

assuming that you have used a cmd/powershell window and executed the “docker-machine.exe create default” command …

open the bash shell in WSL

please add the following to your .bashrc file

export VBOX_MSI_INSTALL_PATH=’/c/Program Files/Oracle/VirtualBox/’

export DOCKER_HOST=tcp://
export DOCKER_CERT_PATH=/c/Users//.docker/machine/machines/default
export DOCKER_MACHINE_NAME=default
cd $(pwd | sed ‘s//mnt/c///c//’)

and then execute “source .bashrc”

Corrected a typo in the path

Had the same problem. Solved by uninstalling kubernet, minikube; removing all related folders, variables, net configs in hyperv. And then reinstalling docker.

I had the same issue after installing some Windows updates.

What solved it for me initially was: Disable Hyper-V in “Add or remove Windows Features”, restart, enable Hyper-V again, restart again

But now a day later the issue crept back. The solution by nicodocoyo worked like a charm. Run socat via docker on the Windows command line and then connect to the custom port from within WSL.

Works great! Thank you for this solution!

Solved it by resetting Shared Drives credentials :

  1. Go to Shared Drives
  2. Hit Reset credentials
  3. Type password again
  4. Share drive again
  5. Apply

Thanks. This solution works great

Thank you.

I have been struggling with this for well over a year. Some days, connectivity to Docker for Windows works flawlessly within WSL. Other days, the dreaded “Cannot connect to the Docker daemon…” error (usually after Windows updates). No amount of restarting / resetting Docker typically helps, and I often have to reboot numerous times until finally it decides it wants to allow connections again.

Right now, I’m having the issue. I can confirm that running this in cmd.exe and then trying to connect in WSL works. I was concerned that this might break volume mounts from WSL, but they too work perfectly.

Thank you!

Make sure to check the box next to the following:

Docker desktop --> Settings --> General --> “Expose daemon on tcp://localhost:2375 without TLS”

1 Like