Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running? I have exposed daemon on tcp://localhost:2375 without TLS via Docker Desktop

When I run the below command on Ubuntu terminal I get below
rr@XXXP:~$ export DOCKER_HOST=tcp://localhost:2375
rr@XXXP:~$ docker ps
Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?

I have exposed daemon on tcp://localhost:2375 without TLS via Docker Desktop.

I can see that I am able to reach http://localhost:2375/info via browser

Using PowerShell on Windows I see below which confirms that port 2375 is open and listening

PS C:\WINDOWS\system32> netstat -ano | findstr 2375
TCP 127.0.0.1:2375 0.0.0.0:0 LISTENING 18300
TCP [::1]:2375 [::]:0 LISTENING 18300

Also, it is not part of excluded port zone

PS C:\WINDOWS\system32> netsh interface ipv4 show excludedportrange protocol=tcp

Protocol tcp Port Exclusion Ranges

Start Port End Port


  5357        5357
 50000       50059     *
 50442       50541
 50542       50641
 50642       50741
 50742       50841
 50842       50941
 50942       51041
    • Administered port exclusions.

I “unset” and try. I see an error

rr@XXXP:~$ unset DOCKER_HOST
rr@XXXP:~$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I have tried all the mentioned options on various sites. Not sure at this point what my options. Please help

Thanks for your time

Thanks
Raj

In this case I am not sure I am right, but since Docker Desktop runs everything (including the docker daemon) in a virtual machine, the problem could be that you can access the local port on your machine but Docker also tries to access it inside the virtual machine where llocalhost could mean something else, an other loopback IP address or it doesn’t exist at all. Since you are also using a WSL distribution for the docker client, it is not clear (to me) what localhost means in these different environments on Windows.

You wrote in the title that you "exposed the daemon on tcp://localhost:2375. How did you do that?

PS.: Please use the “Community” category for questions about the community and events. I moved your question to +Docker Desktop for Windows"