I’m trying to execute Docker commands from a WSL bash terminal and am getting the following error…
$ docker ps Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
I’ve added DOCKER_HOST=tcp://localhost:2375 to my .bashrc and enabled “Expose daemon on tcp://localhost:2375 without TLS” in the Windows Docker settings.
I’ve searched and searched and nobody seems to be running into this problem like I currently am.
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?
@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: https://hub.docker.com/r/alpine/socat/
Simply run the following container to forward the docker daemon to a local port yourself.
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.