This is pointed out and implemented in the docker problem / libnetwork 737
We would like the container to be able to join the network under different names, and not just on behalf of the container.
This will also help docker compose: see docker / compose issue 2312 .
When using the function --x-networkingin docker-compose 1.5 (docker-engine 1.9), you can get the "simple name" added to /etc/hostswithout knowing the container name in advance and without using the container_namedirective?
January 2016 update :
Now this is done in version 1.6.0 (RC1 is missing)
. "" Networking in Compose"
. --x-networking --x-network-driver, Compose 1.5, .
. PR 19242 docker network connect:
--alias .
$ docker network connect --alias db --alias mysql multi-host-network container2
:
-link
$ docker network connect --link container1:c1 multi-host-network container2