Great! That's what I wanted to know! But. I found I can resolve as the host IP address in the container on Docker for Mac. The host networking driver only works on Linux hosts, and is not supported on Docker for Mac, Docker for Windows, or Docker EE for Windows Server. So I tried it and it works on my Linux machine, but it didn't work on my Mac. With this mode, the container seems to be able access to the host with '127.0.0.1'. I found Docker has 'host networking mode'.
So I want my containers to run on both platform. I mainly use Docker for Mac, but sometimes use Linux. I know how to discover container-to-container, but don't know how to get host IP address from a container.
I wanted to access host port from a docker container.įor example, an nginx process is running on the host machine with port 8888 open, then I would like to create a container which can curl host:8888. This information is as of with Docker 18.03.0-ce