Add a docker container to the network under two different names

I am experimenting with a new docker connectivity feature. I migrated my old setup using container links to a new bridge network; so far I have a dedicated bridge network and running between multiple containers on the same host.
Now I am looking for a way to replicate multiple link aliases for the same container.

Say I have a container with a name myBoxthat joins a docker network. I want the same container to be available as myServer.
Using links, I would just set up two links with different aliases.
Is there a way to achieve this with docker?

+3
source share
1 answer

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
+3

All Articles