6 ms·
I have also yet to see a reasonable solution for connecting out of a container back to the host with Docker.app. On linux and OSX with docker-machine this is e
by jonesetc 10y ago
I have also yet to see a reasonable solution for connecting out of a container back to the host with Docker.app.
On linux and OSX with docker-machine this is easy with:
docker run --add-host host:ip.for.docker.interface foo
But there is no equivalent to the docker0 interface or the vboxnet interface for Docker.app.
EDIT: I don't use this for any production environments, but it is very useful for debugging and testing.
- colordrops 10y agoWhat about getting the gateway address from inside the container: HOST_IP=$(/sbin/ip route | awk '/default/ { print $3 }')
- divideby0 10y agoThat works for some use cases, but for others (Elasticsearch, Zookeeper, Kafka, etc) the service inside the container needs to bind to an interface associated with an IP that's also addressable by the host. Even in host networking mode, eth0 inside a DFM-powered container will bound something like 192.168.x.y but that 192.168.x.0 subnet is completely inaccessible from the host.
- justincormack 10y agoThe best solution is to add a new stable, unconflicting IP address to the loopback interface on the Mac and connect to that.
- jonesetc 10y agoStill not as friendly, as it requires system changes on the host, but not totally unreasonable. I'll give it a try if I evaluate Docker.app again.
- moondev 10y agowhy not just bind a port with -p