# Add host ip to container

**URL:** <https://forums.suse.com/t/add-host-ip-to-container/691>\
**Category:** Rancher 1.x\
**Created:** [October 13, 2015, 1:55pm UTC](https://forums.suse.com/t/add-host-ip-to-container/691 "2015-10-13T13:55:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaos](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/kaos/32/38_2.png) [@kaos](https://forums.suse.com/u/kaos)\
**Post date:** [October 13, 2015, 1:55pm UTC](https://forums.suse.com/t/add-host-ip-to-container/691/1 "2015-10-13T13:55:27Z")

</div>

Is there any way to have the hosts ip address registered in the container?  
Something akin to `--add-host=dockerhost:$(get host ip address)` when plain `docker run`.

I know there is a meta data service (`curl rancher-metadata/self/host/agent_ip` gives the address I’m after), but this requires a curl in the container with some accompanying logic to make it all work, and has to be repeated in every container that needs this ip.

What we’re after is to use services that are running on the rancher agent nodes. And I want the container to hit the host it is running on.

Preferably, there would be a label or some such we could use in the compose file that would yield the same effect as the `--add-host` above…

---

<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:** [October 15, 2015, 10:03pm UTC](https://forums.suse.com/t/add-host-ip-to-container/691/2 "2015-10-15T22:03:19Z")

</div>

Currently, the only supported way is through metadata. We purposely put it in metadata. Since there are lots of different use cases for different information, we wanted to standardize the way to achieve it. You could create an issue in GitHub and see if there is enough user interest to put it outside of metadata, but since there is a working solution, we would point to using metadata.

---

<div class="post-metadata">

**Author:** ![kaos](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/kaos/32/38_2.png) [@kaos](https://forums.suse.com/u/kaos)\
**Post date:** [October 16, 2015, 5:02am UTC](https://forums.suse.com/t/add-host-ip-to-container/691/3 "2015-10-16T05:02:23Z")

</div>

Thank you Denise, I’ll think a little harder to see if I can come up with a way to use the meta data that’s transparent enough from the application perspective.
