# Service links or not?

**URL:** <https://forums.suse.com/t/service-links-or-not/3531>\
**Category:** General\
**Created:** [July 26, 2016, 7:20am UTC](https://forums.suse.com/t/service-links-or-not/3531 "2016-07-26T07:20:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cabrinoob](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/cabrinoob/32/1343_2.png) [@cabrinoob](https://forums.suse.com/u/cabrinoob)\
**Post date:** [July 26, 2016, 7:20am UTC](https://forums.suse.com/t/service-links-or-not/3531/1 "2016-07-26T07:20:35Z")

</div>

Hi,  
This is probably a naive question but I wonder why there is the possibility to explicitely link services ?

I have a stack with 2 services : ServiceFrom and serviceTo. ServiceFrom is the entry point and it internally calls ServiceTo over http like this : GET [http://serviceto/hello](http://serviceto/hello)

This work perfectly because the DNS resolution does its job well.

But, when I added ServiceFrom and ServiceTo in my stack I left the “service links” section blank. So I wondered in which case it was interresting to use these links?

Thank you for your help

---

<div class="post-metadata">

**Author:** ![johnrengelman](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/johnrengelman/32/134_2.png) [@johnrengelman](https://forums.suse.com/u/johnrengelman)\
**Post date:** [July 26, 2016, 3:44pm UTC](https://forums.suse.com/t/service-links-or-not/3531/2 "2016-07-26T15:44:17Z")

</div>

I generally default to using them for 2 reasons:

1. if you specify the link, then the in Rancher if you select View Graph on a stack, then there will be a line drawn between the services indicating that one is a dependency of the other. If you don’t specify the link, then this line is not drawn even though it may be a dependency
2. Specifying the link makes the resulting docker-compose.yml portable to a local non-Rancher system. This means I could use the same file to start the stack locally on native Docker using docker-compose and the networking will work. If the link wasn’t specified, then the networking would not work since Rancher’s DNS system doesn’t exist locally.

---

<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:** [July 27, 2016, 10:20pm UTC](https://forums.suse.com/t/service-links-or-not/3531/3 "2016-07-27T22:20:45Z")

</div>

They also allow you to ‘alias’ a dependency, so that your image only needs to know that it will find it’s database by resolving `db`, not that this stack should have it’s database provided by the `mysql-db-07-01` service.

And we may eventually add options to allow restricting inter-container communication (more than anybody in the environment can talk to anybody else). Links would provide the declaration of what dependencies there are and what communication flows should be allowed.
