No; beta 9 made the port publishing mechanism much closer to what’s on Linux, and the artificial docker.local hostname (which was never published to containers) is gone. You need to use normal container linking, or use the DNS-based container lookup on a private Docker network, or whatever other service discovery system you use.
Oh got it. See the table at the bottom for the test results (v1.11.0-beta9 used). As you pointed out, docker for mac failed to handle hostname when net=host.
I think it’s good to have the same behavior on docker for mac. I guess it should return the hostname of the mac.
I’m curious why you need it. I guess some apps use hostname to determine its environment (e.g. newrelic), but I doubt they actually send some traffic to the hostname.
| env | hostname | ping | hostname (net=host) | ping (net=host) |
|--------------------------|---------------------|------|--------------------------------|-----------------|
| native (docker on linux) | docker container id | ok | hostname | ok |
| docker-machine | docker container id | ok | hostname (docker-machine name) | ok |
| docker for mac | docker container id | ok | "docker" | failed |
docker run --rm -it debian:jessie sh -c 'hostname -s; ping -c 1 $(hostname -s)'
docker run --rm -it --net host debian:jessie sh -c 'hostname -s; ping -c 1 $(hostname -s)'
I need it because things tend to bind to the hostname they are on. Some other things also tend to report hostname and/or hostname’s IP as own address. Mesos and HBase do these things among others.
Is there a way to connect do a docker container running with host networking on mac? I can’t find how to do it in docs.
Not sure if we are going to support this, it is not normal to set this when you use dhcp, which we do at present. There is currently no way to connect from the host if you use host networking, as you saw, so it is not very useful, so making changes to support its use is not a priority at the moment. The routing may change at some point in the future, but we are waiting on bug fixes from Apple to make a decision on that.