In "naked" Docker, I can use --network=host
to make the host reachable from the container through the docker0
interface at 127.0.0.1
, or I can reach the host at 172.17.0.1
.
Ostensibly docker-compose
supports the host networking driver through network_mode: host
. Unfortunately, this prevents me from using exposed ports. Containers created using docker-compose
don't live on the docker0
interface, and hence can reach the host at some IP address like 172.18.0.1
or 172.19.0.1
, decided at startup.
Even once I know that address, it doesn't seem to be reachable from the container.
How can I connect from the container to the host?