# Suggestion : Variables in host

**URL:** <https://forums.suse.com/t/suggestion-variables-in-host/1581>\
**Category:** Rancher 1.x\
**Created:** [January 29, 2016, 9:17pm UTC](https://forums.suse.com/t/suggestion-variables-in-host/1581 "2016-01-29T21:17:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kvaes](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/kvaes/32/972_2.png) [@kvaes](https://forums.suse.com/u/kvaes)\
**Post date:** [January 29, 2016, 9:17pm UTC](https://forums.suse.com/t/suggestion-variables-in-host/1581/1 "2016-01-29T21:17:46Z")

</div>

Would it be possible to foresee a variable in the networking hostname?

Use case ;  
I use datadog as monitoring tool. They support an agent deployment as a container.  
So I’ve added a service where I indicate that the container needs to run on all hosts.  
Though the way they distinguish hosts is on hostname.  
So when I choose one myself, all the hosts are named the same. When I use the containername, then the software break on the usage of an underscore.

---

<div class="post-metadata">

**Author:** ![kvaes](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/kvaes/32/972_2.png) [@kvaes](https://forums.suse.com/u/kvaes)\
**Post date:** [January 29, 2016, 9:19pm UTC](https://forums.suse.com/t/suggestion-variables-in-host/1581/2 "2016-01-29T21:19:25Z")

</div>

Their intake is that the hostname is not compliant with RFC1123

[https://www.ietf.org/rfc/rfc1123.txt](https://www.ietf.org/rfc/rfc1123.txt)

---

<div class="post-metadata">

**Author:** ![kvaes](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/kvaes/32/972_2.png) [@kvaes](https://forums.suse.com/u/kvaes)\
**Post date:** [January 30, 2016, 11:36am UTC](https://forums.suse.com/t/suggestion-variables-in-host/1581/3 "2016-01-30T11:36:18Z")

</div>

FYI - A “hack” to fix the implementation is to set the networking to host… Though I don’t like that approach.

---

<div class="post-metadata">

**Author:** ![0ff](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/0ff/32/862_2.png) [@0ff](https://forums.suse.com/u/0ff)\
**Post date:** [February 11, 2016, 4:23pm UTC](https://forums.suse.com/t/suggestion-variables-in-host/1581/4 "2016-02-11T16:23:08Z")

</div>

Same problem here. We found another solution in not setting a hostname at all so that a random id is used per agent instance.  
Our docker-compose.yml looks like this:

```auto
dd-agent:
  environment:
    API_KEY: ...
  labels:
    io.rancher.scheduler.global: 'true'
    io.rancher.container.pull_image: always
    io.rancher.container.start_once: 'true'
  tty: true
  image: datadog/docker-dd-agent:latest
  privileged: true
  volumes:
  - /var/run/docker.sock:/var/run/docker.sock
  - /proc/mounts:/host/proc/mounts:ro
  - /sys/fs/cgroup/:/host/sys/fs/cgroup:ro
  stdin_open: true

```

Still, rancher should either allow to pass-through the real hostname (`io.rancher.container.hostname_override: host_name` maybe?) or create RFC-compliant container names.

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [February 11, 2016, 7:20pm UTC](https://forums.suse.com/t/suggestion-variables-in-host/1581/5 "2016-02-11T19:20:27Z")

</div>

> <https://github.com/rancher/rancher/issues/3589>
>
> The hostname\_override compose label sets the hostname to the container\_name as stated here: StackName\_ServiceName\_CreateIndex.
> As this is not a valid hostname because...
