Autodiscover service over multiple hosts

Hi i need create an infrastucture composed by 6 hosts and i need the
container of different hosts can communicate…now i use consul and
registrator, but on rancher i don’t know how make this…it is

sure it is possible.
Communication across multiple hosts is present in rancher since many months, before docker 1.9 which just add it few weeks ago.
Your hosts need to be part of the same environment (one ‘default’ environment is present when you start your rancher/server container), and they will can reach each other.
You will have to open ports on containers, and reference the ip address (which is dynamically assigned to containers when they are created):(you will get this ip address via the metadata feature.
best regards,


Thanks for reply but don’t understand how can call other docker container, i have this situation

For example, what name i need use to call container mysql of host 2 from apache of host 1?
host 1 = left
host 2 = right

In this case you’re probably best using links between the containers. Rancher will then sort out the internal DNS entries to locate mysql wherever it is or ends up

I would not use the links because if I had to restart or fail a container, will close also the linked container

i would not advice to use links because docker deprecate them since docker 1.9 (
you should better use the metadata feature coupled with confd to reference the ip of the host and the external port open.


best regards,


Oh ok. The docker networks stuff isn’t in Rancher yet though as Rancher has its own networking infrastructure. I wonder where they are going now. I do like the idea of segmented networks. Easier to explain in governance questionnaires.

rancher aims to stand on docker closely as far as i understand (i’m not part of the rancher team).
I don’t know if the docker network stack is already integrated into rancher.
The segmented network in rancher is done via environments.
Multiple environments, cannot be configured on the same host.
Back to your initial question : how to specify in one container how to reach another one ?
You have to query the internal DNS, at container startup , which can be done either roughly via curl or wget, or more smoothly via confd which integrate the rancher backend.
Confd will generate a config file, according to the template you’ve provided.

Hope it helps,