# Can't resolve simple container names within sidekick structure

**URL:** <https://forums.suse.com/t/cant-resolve-simple-container-names-within-sidekick-structure/3876>\
**Category:** Rancher 1.x\
**Created:** [September 2, 2016, 3:43am UTC](https://forums.suse.com/t/cant-resolve-simple-container-names-within-sidekick-structure/3876 "2016-09-02T03:43:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bferns](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bferns](https://forums.suse.com/u/bferns)\
**Post date:** [September 2, 2016, 3:43am UTC](https://forums.suse.com/t/cant-resolve-simple-container-names-within-sidekick-structure/3876/1 "2016-09-02T03:43:09Z")

</div>

I want to check I’m not doing something crazy here. We have a stack that consists of a loadbalancer (lb), pointing to an nginx container (web), that has DB (db) and PHP (api) containers as sidekicks.

When run locally using links (without the lb container, or with a haproxy replacement) the web container can resolve api fine as ‘api’ via its hosts file.

When run on rancher with web as the primary and ap i& db as sidekicks (without links, as suggested), the web container gets into a fail/restart loop as it cant resolve ‘api’. (The error is ‘host not found in upstream “api”’).

However if we use [api.web](http://api.web) to refer to the api sidekick inside the web container, the api container can be resolved. This messes with a lot of config files that are depending on api being ‘api’ whether run locally, on docker cloud, or on rancher.

Is this the intended behaviour (I swear a few months ago I was running setups like this without issues)? If so, how can it be circumvented? I considered reading out the [api.web](http://api.web) IP address and adding it to a line in etc/hosts on startup, but that feels very messy.

I’ve posted a simplified compose file below:

```
web:
  image: nginx public
  expose:
    - 80
  volumes_from:
    - api
  labels:
      io.rancher.sidekicks: api,db
      io.rancher.scheduler.affinity:host_label: client=apiv1
api:
  image: api image (based on php public)
  expose: 
    - 9000
  labels:
     io.rancher.scheduler.affinity:host_label: client=apiv1
db:
      image: 'mysql:latest'
      expose: 
        - 3306
      labels:
    io.rancher.scheduler.affinity:host_label: client=apiv1
```

---

<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:** [September 2, 2016, 5:28am UTC](https://forums.suse.com/t/cant-resolve-simple-container-names-within-sidekick-structure/3876/2 "2016-09-02T05:28:46Z")

</div>

What version of Rancher?

---

<div class="post-metadata">

**Author:** ![bferns](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bferns](https://forums.suse.com/u/bferns)\
**Post date:** [September 2, 2016, 5:46am UTC](https://forums.suse.com/t/cant-resolve-simple-container-names-within-sidekick-structure/3876/3 "2016-09-02T05:46:07Z")

</div>

1.1.3 currently, though we also saw the same behaviour with previous versions (definitely as early as 1.1.1).

Heres the results from the hosts & resolv.conf file and some test pings

 ![](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/6/65c60bcfa14094d2b8afe3fb294558841c0804ee.png)

---

<div class="post-metadata">

**Author:** ![bferns](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bferns](https://forums.suse.com/u/bferns)\
**Post date:** [September 23, 2016, 1:57pm UTC](https://forums.suse.com/t/cant-resolve-simple-container-names-within-sidekick-structure/3876/4 "2016-09-23T13:57:14Z")

</div>

I think this issue is related - I’m using alpine linux as well but haven’t tested the workarounds yet:

[https://github.com/rancher/rancher/issues/5041#issuecomment-245380438](https://github.com/rancher/rancher/issues/5041#issuecomment-245380438)

---

<div class="post-metadata">

**Author:** ![mreferre](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@mreferre](https://forums.suse.com/u/mreferre)\
**Post date:** [December 30, 2016, 10:07pm UTC](https://forums.suse.com/t/cant-resolve-simple-container-names-within-sidekick-structure/3876/5 "2016-12-30T22:07:21Z")

</div>

@bferns I just came across this same problem. I had to end up sticking together a few containers in sidekicks (because I had to “volume\_from” and all of a sudden everything broke. It took me a bit to figure out the problem was due to resolution and a quick search on Google linked this thread.

The good news is that I tried the workaround you linked and it worked (I basically added as a search dns parameter the name of the main container to all of the sidekicks (and they now can resolve each others by container name).

Thanks!

---

<div class="post-metadata">

**Author:** ![TomHutter](https://avatars.discourse-cdn.com/v4/letter/t/eada6e/32.png) [@TomHutter](https://forums.suse.com/u/TomHutter)\
**Post date:** [January 15, 2017, 8:27am UTC](https://forums.suse.com/t/cant-resolve-simple-container-names-within-sidekick-structure/3876/6 "2017-01-15T08:27:48Z")

</div>

It helped me to use the notification mentioned in [https://docs.rancher.com/rancher/v1.2/zh/cattle/internal-dns-service/](https://docs.rancher.com/rancher/v1.2/zh/cattle/internal-dns-service/)

Example:  
I have a service called projects running a (alpine) nginx and a sidekick called redmine. So I have set a directive  
`proxy_pass http://redmine.projects:3000;`  
in my nginx container.
