0

I am on windows 2019 server machine. I am running centos docker on it .

Is there anyway to achieve results same as --network host on windows ; On Linux --network host ensures

  1. All port mapped from host to container
  2. the container IP address is same as host .

Unfortunately --network host is available only on Linux and I don't know when will windows give it but I need some workaround

For 1 I have resorted to doing -p 3000:3000 for all the ports which were required but I am unable to give same IP to the container and that is blocker for me .

MAG
  • 2,841
  • 6
  • 27
  • 47
  • `docker run -p`, and using the host's IP address, is the standard way to interface with Docker containers. You're not "resorting to" anything by doing this. Is there a specific problem you're encountering with this approach? – David Maze Oct 28 '20 at 15:58
  • A third party server i internally tries to identify ip . it gets local ip address but i want it to get ip of host as the second service is running on the host and not on the contianer and hence its not able to communicare . Hence i want that container when it tries to fetch ip address of itself it gets host ip address only – MAG Oct 29 '20 at 05:33
  • [How to get the IP address of the docker host from inside a docker container](https://stackoverflow.com/questions/22944631/how-to-get-the-ip-address-of-the-docker-host-from-inside-a-docker-container) discusses this more. The most reliable way will be to explicitly pass it in as an environment variable. (What if "the host" is a VM? Or the host's network is itself a private network behind a NAT gateway?) – David Maze Oct 29 '20 at 10:44

0 Answers0