Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add dns alias' to containers #574

Closed
glinton opened this issue Sep 12, 2017 · 0 comments
Closed

Add dns alias' to containers #574

glinton opened this issue Sep 12, 2017 · 0 comments

Comments

@glinton
Copy link
Contributor

glinton commented Sep 12, 2017

Use case

User launches two apps with nanobox to test locally. Adds app1.com as alias for his first app. He wants to connect to it from his second app. Inside app 2, app1.com wouldn't resolve to his other application.

Solution

Utilize docker's --add-host when starting (run) the containers. If we only add to create, then we'd run into a destroy&recreate apps loop to try getting them updated ips.

Update to proposed solution

After some investigation/prototyping. It appears the best way to solve this (without running a DNS server and configuring the containers' resolv.conf to point to it) is in the hooks; configure maybe. The ExtraHosts is only available in container create and run (surprisingly it is not part of update), since we only create then start, we'd run into app1 not knowing about app2, but app2 knowing about app1. (unless perhaps the user adds all the dns aliases prior to running or deploy dry-running anything). Adding this to the hooks would have its own drawbacks however, as we would still likely want to preserve the original entries (which i believe come from the host's /etc/hosts file). Simplest way could be to just dump the hosts file contents into the payload for whatever hook we solve this with.

glinton added a commit to nanobox-io/nanobox-hooks-code that referenced this issue Sep 26, 2017
glinton added a commit to nanobox-io/nanobox-docker-build that referenced this issue Sep 26, 2017
glinton added a commit that referenced this issue Sep 26, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant