-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve links set as DNS to their ip address. #1138
Conversation
When a dns section contains names of linked services, the names are replaced with the container addresses. Signed-off-by: Ruben <github-com-00ff86@vandamme.email>
Interesting idea, I can see this being quite useful, especially if you want to integrate with one of the many dynamic-dns-for-containers-as-a-container options. It might be worth it to make the syntax |
@@ -189,7 +189,7 @@ net: "host" | |||
|
|||
### dns | |||
|
|||
Custom DNS servers. Can be a single value or a list. | |||
Custom DNS servers. Can be a single value or a list. Names of linked containers are resolved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could use a bit more documentation, maybe an example below?
Won't this be a problem if the linked service is restarted and changes its IP address? Also (not sure if that would help here), I think some changes were made recently to dynamically update resolv.conf in some cases. |
Ya, I don't think this should use linked services. It should work with a container outside of the composition. |
Well, then fun thing of course is that a linked container will be in |
@thaJeztah I've tried adding "dns" directly in /etc/resolv.conf, but that didn't work. |
I'm 👍 on this, or at least something like this. I want to run a dns resolver container that can be used by all the other containers, to be able to take advantage of the dns part of consul. |
Interesting idea. @dnephin's Two things:
|
The usual workaround for using a dns runing in a container from other containers is to let the dns container:
This way other containers can refer to it as As a consul specific description see the README at https://github.com/progrium/docker-consul |
👍 this feature would be great, in my case to model distributed systems with circular dependencies. Manual links don't work in that case. |
@lalyos Thank you for highlighting the |
@steve-jansen @lalyos please note that with docker 1.9, the IP-address is not guaranteed to be 172.17.42.1; moby/moby#17305 |
Thanks again for the PR. Since this PR was first opened a lot has changed. We now have user defined networks in Docker, and in the next release they should be using an embedded DNS server to handle "discovery". There should be much less of a need for these dns discovery services now that it's built into Docker. I'm going to close this PR since this functionality should be handled in the next release. If you're interested in following the proposals you can find more information here: |
When a dns section contains names of linked services,
the names are replaced with the container addresses.
Example:
This will configure the following resolv.conf in the "web" container: