# 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:** 2

<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 日午前 12:04 UTC](https://meta.discourse.org/t/update-etc-hosts-at-rebuild/68703/2 "2017-08-25T00:04:57Z")

</div>

Pretty sure your quotes are wrong.

```yaml
run:  
   - exec: echo '192.168.0.1 custom.domain.fr' >> /etc/hosts

```

The issue seems to be, that command will work just fine, but will be lost on container start. Go ahead and enter the container, run the command by hand, then restart it:

```sh
./launcher enter app
echo '192.168.0.1 custom.domain.fr' >> /etc/hosts
grep custom /etc/hosts
192.168.0.1 custom.domain.fr
exit
./launcher restart app
./launcher enter app
grep custom /etc/hosts

```

Not quite sure what process is rewriting the `/etc/hosts` file.

This works:

```plaintext
./launcher start app
docker exec -it app bash -c "echo 192.168.0.1 custom.domain.fr >> /etc/hosts"

```

But you’d need to do that every start. (And if you try to modify `launcher` to do that for you, `launcher` will get upset when it can’t update itself with `git`. Ask me how I know this? I’ve done that.)

---

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