# Autodiscover service over multiple hosts

**URL:** <https://forums.suse.com/t/autodiscover-service-over-multiple-hosts/1210>\
**Category:** Rancher 1.x\
**Created:** [December 9, 2015, 4:59pm UTC](https://forums.suse.com/t/autodiscover-service-over-multiple-hosts/1210 "2015-12-09T16:59:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefanocog](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@stefanocog](https://forums.suse.com/u/stefanocog)\
**Post date:** [December 9, 2015, 4:59pm UTC](https://forums.suse.com/t/autodiscover-service-over-multiple-hosts/1210/1 "2015-12-09T16:59:46Z")

</div>

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  
possible?

---

<div class="post-metadata">

**Author:** ![clescot](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/clescot/32/317_2.png) [@clescot](https://forums.suse.com/u/clescot)\
**Post date:** [December 9, 2015, 9:50pm UTC](https://forums.suse.com/t/autodiscover-service-over-multiple-hosts/1210/2 "2015-12-09T21:50:31Z")

</div>

Hi,  
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,

Charles.

---

<div class="post-metadata">

**Author:** ![stefanocog](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@stefanocog](https://forums.suse.com/u/stefanocog)\
**Post date:** [December 10, 2015, 9:47am UTC](https://forums.suse.com/t/autodiscover-service-over-multiple-hosts/1210/3 "2015-12-10T09:47:38Z")

</div>

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

 ![](https://us1.discourse-cdn.com/flex022/uploads/suse/original/1X/32441ec7a12432a4f6b143fff2dccf65400bdc2f.png)

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

---

<div class="post-metadata">

**Author:** ![kiboro](https://avatars.discourse-cdn.com/v4/letter/k/7993a0/32.png) [@kiboro](https://forums.suse.com/u/kiboro)\
**Post date:** [December 10, 2015, 11:22am UTC](https://forums.suse.com/t/autodiscover-service-over-multiple-hosts/1210/4 "2015-12-10T11:22:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stefanocog](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@stefanocog](https://forums.suse.com/u/stefanocog)\
**Post date:** [December 10, 2015, 1:19pm UTC](https://forums.suse.com/t/autodiscover-service-over-multiple-hosts/1210/5 "2015-12-10T13:19:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![clescot](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/clescot/32/317_2.png) [@clescot](https://forums.suse.com/u/clescot)\
**Post date:** [December 11, 2015, 3:03pm UTC](https://forums.suse.com/t/autodiscover-service-over-multiple-hosts/1210/6 "2015-12-11T15:03:26Z")

</div>

Hi,  
i would not advice to use links because docker deprecate them since docker 1.9 ([https://docs.docker.com/engine/userguide/networking/dockernetworks/#legacy-links](https://docs.docker.com/engine/userguide/networking/dockernetworks/#legacy-links)).  
you should better use the metadata feature coupled with confd to reference the ip of the host and the external port open.

cf docs.rancher.com/rancher/metadata-service/

best regards,

Charles.

---

<div class="post-metadata">

**Author:** ![kiboro](https://avatars.discourse-cdn.com/v4/letter/k/7993a0/32.png) [@kiboro](https://forums.suse.com/u/kiboro)\
**Post date:** [December 11, 2015, 3:16pm UTC](https://forums.suse.com/t/autodiscover-service-over-multiple-hosts/1210/7 "2015-12-11T15:16:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![clescot](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/clescot/32/317_2.png) [@clescot](https://forums.suse.com/u/clescot)\
**Post date:** [December 11, 2015, 4:24pm UTC](https://forums.suse.com/t/autodiscover-service-over-multiple-hosts/1210/8 "2015-12-11T16:24:48Z")

</div>

Hi,  
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,

Charles.
