# How to specify default ENVIROMENT variable value in docker-compose?

**URL:** <https://forums.suse.com/t/how-to-specify-default-enviroment-variable-value-in-docker-compose/2574>\
**Category:** General\
**Created:** [April 22, 2016, 9:01pm UTC](https://forums.suse.com/t/how-to-specify-default-enviroment-variable-value-in-docker-compose/2574 "2016-04-22T21:01:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![virtuman](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/virtuman/32/1046_2.png) [@virtuman](https://forums.suse.com/u/virtuman)\
**Post date:** [April 22, 2016, 9:01pm UTC](https://forums.suse.com/t/how-to-specify-default-enviroment-variable-value-in-docker-compose/2574/1 "2016-04-22T21:01:56Z")

</div>

Is there any way to specify default ENV value in docker-compose?

something like:

- ROOT\_URL=${ROOT\_URL\_PROTO:https}://${ROOT\_URL\_HOST:system.domain.com}

thank you?

---

<div class="post-metadata">

**Author:** ![joshwget](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/joshwget/32/704_2.png) [@joshwget](https://forums.suse.com/u/joshwget)\
**Post date:** [April 22, 2016, 9:26pm UTC](https://forums.suse.com/t/how-to-specify-default-enviroment-variable-value-in-docker-compose/2574/2 "2016-04-22T21:26:43Z")

</div>

Unfortunately, Docker Compose doesn’t currently support this feature. If it ever gets added, we’ll add it to Rancher Compose.

---

<div class="post-metadata">

**Author:** ![virtuman](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/virtuman/32/1046_2.png) [@virtuman](https://forums.suse.com/u/virtuman)\
**Post date:** [April 25, 2016, 10:59pm UTC](https://forums.suse.com/t/how-to-specify-default-enviroment-variable-value-in-docker-compose/2574/3 "2016-04-25T22:59:40Z")

</div>

Cool, thanks.

is there a way to use host’s hostname when spinning up the container? or just a way to get an hostname somehow from the container?

---

<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:** [May 4, 2016, 7:10pm UTC](https://forums.suse.com/t/how-to-specify-default-enviroment-variable-value-in-docker-compose/2574/4 "2016-05-04T19:10:32Z")

</div>

We don’t have the ability to set the host’s hostname into the container, but you can set the container’s hostname yourself.

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

You can get the hostname of the container through Rancher’s [metadata service](http://docs.rancher.com/rancher/rancher-services/metadata-service/)
