0

first of all, I don't have much network experience or knowledge, especially regarding docker containers, so please be gentle. I am running a host machine with docker for windows and need to start linux containers. Those linux containers get passed an environment variable with the IP of the server the service in the container needs to connect to. I suspect this part works, as the server registers that a client has connected with the IP 172.17.0.2 and looking up the ifconfig inside the container confirms this as it also shows IP 172.17.0.2. I suspect that this IP got generated by some docker networking isolation stuff as this cannot be reached from outside.

Now to the problem. The service running in linux container probably sends a notifaction to the server about it's existance and with it the local ip of the container. When the server tries to send a command to a registerd client it responds with find

Failed to find host 172.17.0.2

So, I need the docker container to use the the real IP of the windows host. Instinctively, I turned to passing --network host as a parameter for docker run, but doesn't seem to be supported with docker for windows. Passing the host's IP via --ip didn't work either as the interal container IP remained at 172.17.0.2.

These posts seems to be very related How to connect to docker host from container on Windows 10 (Docker for Windows)

Container can not resolve docker.for.win.localhost , but --dns host.docker.internal or docker.for.win.localhost resulted in

invalid argument "host.docker.internal" for "--dns" flag: host.docker.internal is not an ip address

am I maybe missunderstanding how to use them? Other ideas on solving the problem?

user12485414
  • 53
  • 1
  • 5

0 Answers0