1

I am using Docker Windows with WSL2.

From some answers I understand that connecting to an IP address exposed to the host network can be done from within a Docker container without any particular setup, but I cannot do it. Note that I do not want to access localhost, but a specific IP address (and port) of another device exposed to the host network.

I read a couple reasons on what could be the issue:

  1. Missing firewall exception to allow communication between the external IP and the IP of the container.
  2. I may have to use network_mode: "host", which however only seems to work in Linux

Many thanks.

Pippo
  • 1,543
  • 3
  • 21
  • 40
  • Does this answer your question? [From inside of a Docker container, how do I connect to the localhost of the machine?](https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach) – Turing85 Dec 01 '22 at 21:05
  • 1
    Not "localhost". It is another device at a given IP address on the host network. – Pippo Dec 01 '22 at 21:24
  • 1
    My expectation would also be that you can just connect to it. You don't need host networking or any other particular setup. If your question is different from the second question you link to, could you [edit] the question demonstrating a particular setup where it doesn't work? – David Maze Dec 01 '22 at 22:49

0 Answers0