# Update /etc/hosts at rebuild

**URL:** <https://meta.discourse.org/t/update-etc-hosts-at-rebuild/68703>\
**Category:** Self-hosting\
**Created:** [2017 年 8 月 24 日午後 3:19 UTC](https://meta.discourse.org/t/update-etc-hosts-at-rebuild/68703 "2017-08-24T15:19:18Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)\
**Post date:** [2017 年 8 月 25 日午前 4:45 UTC](https://meta.discourse.org/t/update-etc-hosts-at-rebuild/68703/3 "2017-08-25T04:45:26Z")

</div>

> [@Chopper](#):
>
> Any how to update the /etc/hosts at rebuild ?

Okay, I figured it out. You cannot use the yml file because `/etc/hosts` is created at runtime by Docker itself. To add entries to it, you need to use the `--docker-args` option to `launcher` at rebuild time.

```plaintext
./launcher rebuild app --docker-args "--add-host extra.dns:8.8.8.8"
./launcher enter app
grep extra /etc/hosts
8.8.8.8 extra.dns

```

There are a slew of dns / resolver / similar options for `docker run`, and those are the ones you need to use for this sort of stuff.

---

_[View the full topic](https://meta.discourse.org/t/update-etc-hosts-at-rebuild/68703)._
