'how to expose 2375 from Docker desktop for windows
I'm new to Docker. My Docker Desktop for Windows version is 19.03.5.
I want to expose port 2375 from Docker desktop for windows, but if I use the GUI setting,
that only can be accessed via tcp://127.0.0.1, My inner IP address 192.168.3.9 doesn't work.
https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/configure-docker-daemon.
The document said to edit the C:\ProgramData\Docker\config\daemon.json and add "hosts": ["tcp://0.0.0.0:2375"], but it's doesn't work for any IP address, I'm very sure I did it as the document.
So what should I do can make access via tcp://192.168.3.9 from another computer which in the same subnet?
Solution 1:[1]
In some configuration (WSL2 backend / Linux container), you cannot force com.docker.proxy.exe to expose TCP port 2375 (it will bind 127.0.0.1:2375 for ever)
Use a simple NAT forwarding rules
netsh interface portproxy add v4tov4 listenport=2375 listenaddress=[public IP, NOT 0.0.0.0] connectaddress=127.0.0.1 connectport=2375
To achieve what you want
Solution 2:[2]
The GUI setting is a linux container, that's the problem, switch to the windows container and edit the C:\ProgramData\Docker\config\daemon.json and add "hosts": ["tcp://0.0.0.0:2375"] gonna be work.
Solution 3:[3]
Similar to the @131 answer. The issue is that Docker runs in 2375 but its bound just for localhost in some setups (WSL2 backend / Linux container)
This should work running as administrator:
netsh interface portproxy add v4tov4 listenport=3375 listenaddress=0.0.0.0 connectaddress=127.0.0.1 connectport=2375
Then you could execute in the client
DOCKER_HOST=192.168.1.1:3375 docker ps
or
docker -H tcp://192.168.1.10:3375 ps
where 192.168.1.1 is your the Docker host IP
Solution 4:[4]
DEng, your solution crashes the docker desktop
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Deng |
| Solution 3 | luisfernando |
| Solution 4 | eliassal |
