1

In one of my test setups, I have code which is sometimes runs inside a docker container that wants to connect to a port on the host machine.

It is configured to try to connect to localhost:12345. That works when it is running outside the container, but obviously fails when it runs inside the container.

Is there a way to map a port on the local host into the container? This is the reverse of the normal port mapping, where you expose a port in the container to the host.

I can see potential security issues with this, and also that it breaks the paradigm of "the container is the world", so I would not be surprised if it is not supported.

Troy Daniels
  • 3,270
  • 2
  • 25
  • 57
  • 4
    Possible duplicate of [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) – Siyu Dec 13 '18 at 16:48

0 Answers0