# Docker Service Service Discovery Equivalent

**URL:** <https://forums.suse.com/t/docker-service-service-discovery-equivalent/4748>\
**Category:** Rancher 1.x\
**Created:** [November 30, 2016, 8:57pm UTC](https://forums.suse.com/t/docker-service-service-discovery-equivalent/4748 "2016-11-30T20:57:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tibmeister](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/tibmeister/32/1897_2.png) [@tibmeister](https://forums.suse.com/u/tibmeister)\
**Post date:** [November 30, 2016, 8:57pm UTC](https://forums.suse.com/t/docker-service-service-discovery-equivalent/4748/1 "2016-11-30T20:57:30Z")

</div>

So in Docker swarm mode (1.12) I have the ability to create a service, even one with 1 replica, and through the DNS Service Discovery mechanism built into swarm mode I can point to any host in the swarm and it is all routed to the container without added effort. I’m not seeing where this is possible in Rancher; what I’ve done as a workaround is to create a stack, then use a load-balancer to provide the service discovery mechanism but I like the cleanliness of swarm mode so can that be done in Rancher?

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [November 30, 2016, 11:37pm UTC](https://forums.suse.com/t/docker-service-service-discovery-equivalent/4748/2 "2016-11-30T23:37:56Z")

</div>

This is how Rancher has worked since long before Swarm existed… Every service in every stack on managed networking gets a DNS entry which resolves to all the IPs of healthy containers for that service. [https://docs.rancher.com/rancher/v1.1/en/cattle/internal-dns-service/](https://docs.rancher.com/rancher/v1.1/en/cattle/internal-dns-service/)

---

<div class="post-metadata">

**Author:** ![tibmeister](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/tibmeister/32/1897_2.png) [@tibmeister](https://forums.suse.com/u/tibmeister)\
**Post date:** [December 1, 2016, 1:21am UTC](https://forums.suse.com/t/docker-service-service-discovery-equivalent/4748/3 "2016-12-01T01:21:37Z")

</div>

So then something is seriously foobared because if I run a service, say redis, with the port-mapping of 6379:6379 and have only one instance of it in my 6 node swarm that’s running on say node 4, if I try to connect to any host other than node 4 I get connection refused. I setup the load balancer and violla, no issues.  
I do the same with docker service create and no issues. So is there something I’m missing in my stack/service config? Including them below for reference

# docker-compose.yml

redis-mq:  
ports:

- 6379:6379/tcp  
image: lab/redis:latest  
utils-5-5:  
log\_driver: syslog  
labels:  
io.rancher.scheduler.affinity:host\_label: location=1  
tty: true  
command:
- /root/redisQueueWatcher.sh
- -q
- lab  
log\_opt:  
syslog-address: udp://172.0.0.1:514  
tag: viperl55  
image: lab/utils-vip5.5:latest  
pid: host  
privileged: true  
volumes:
- /usr/local/gs3-virt-scripts:/usr/local/scripts
- /opt/utils:/opt/utils
- /var/log/central:/var/log/central
- /data/DataFiles:/data/DataFiles  
working\_dir: /root  
stdin\_open: true

# rancher-compose.yml

redis-mq:  
scale: 1  
utils-5-5:  
scale: 10  
retain\_ip: true

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [December 1, 2016, 8:35am UTC](https://forums.suse.com/t/docker-service-service-discovery-equivalent/4748/4 "2016-12-01T08:35:47Z")

</div>

Maybe I misread your message…

You can resolve `redis-mq[.stackname.rancher.internal]` on any host and it will resolve to the 10.42.x.y IP(s) assigned to the container(s) of that services. Connecting to those IPs will go over the IPSec overlay network and get you to that container regardless of what host the client and service are on.

The actual host port 6379 is only published on hosts that are running the actual containers. So you cannot go to $any\_public\_host\_ip\_in\_the\_environment:6379. That would mean only one service could use that port in the entire environment.

---

<div class="post-metadata">

**Author:** ![tibmeister](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/tibmeister/32/1897_2.png) [@tibmeister](https://forums.suse.com/u/tibmeister)\
**Post date:** [December 1, 2016, 3:55pm UTC](https://forums.suse.com/t/docker-service-service-discovery-equivalent/4748/5 "2016-12-01T15:55:13Z")

</div>

Yep, after digging in more and playing around it does look like the mesh routing of Docker swarm mode isn’t in Rancher, but using the load balancer provides similar functionality. I think a lot of it was around my own expectations of having an environment in Rancher set as Swarm made it just talk to the docker-engine running in swarm mode but that isn’t the case; it seems it’s more of the traditional Swarm configuration pre-1.12.

Internally though I should be able to resolve redis-mq.utils.rancher.internal where utils is the stack name so that may meet the needs without issue.

I think you’ve answered my question by setting my expectations around this topic; thank you very much for that! It’s one thing to check off the list.
