Skip to content
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

[feature] add driver.docker.bridge_ip client attribute #2785

Closed
camerondavison opened this issue Jul 6, 2017 · 10 comments
Closed

[feature] add driver.docker.bridge_ip client attribute #2785

camerondavison opened this issue Jul 6, 2017 · 10 comments

Comments

@camerondavison
Copy link
Contributor

this way things that need to talk to something that is on the host machine and bound to the bridge ip (ie consul dns) can use it

https://www.nomadproject.io/docs/drivers/docker.html#client-attributes

@schmichael
Copy link
Member

master (and soon 0.6) are able to advertise the Docker IP in Consul: https://github.com/hashicorp/nomad/blob/master/website/source/docs/drivers/docker.html.md#advertising-container-ips

Is this sufficient?

@camerondavison
Copy link
Contributor Author

I don't understand what you mean by the "docker ip"? is that the bridge ip?

I don't think that will work because I need to set the https://www.nomadproject.io/docs/drivers/docker.html#dns_servers dns_servers param to be an IP that the container can talk to. So if consul is bound to the docker bridge (example 172.17.0.1) then it needs to be set to that, or it will have to be set to something like "${attr.unique.network.ip-address}" and make sure that consul is bound to the same ip as that attribute.

@schmichael
Copy link
Member

I don't understand what you mean by the "docker ip"? is that the bridge ip?

The IP Docker assigns to the container, so in the bridge's subnet but not the bridge's IP. The ports your container exposes are reachable on that IP from the host.

So if consul is bound to the docker bridge (example 172.17.0.1) then it needs to be set to that

Hm, I don't think if you run Consul in Docker with bridge networking it will be bound to the bridge's IP. It will be bound to the next free IP in the bridge's subnet. That's the IP the feature I linked would advertise. However if Consul is the service you wish to discover, advertising it in Consul isn't going to help!

I think for now running Consul with host networking is your best option as once services can reach Consul they can advertise/discover any other services as needed. Consul itself is just kind of a special case and needs to be in a known location. It's not possible to have the location be known with bridge networking because you don't know what IP the Consul container will be assigned even if the port is statically assigned.

@camerondavison
Copy link
Contributor Author

camerondavison commented Jul 7, 2017 via email

@schmichael
Copy link
Member

Ah! I understand now. Thanks for the extra details.

How is Nomad connecting to Consul? As a workaround for now you can always create your own meta key with the IP: https://www.nomadproject.io/docs/agent/configuration/client.html#meta

@camerondavison
Copy link
Contributor Author

camerondavison commented Jul 7, 2017 via email

@schmichael
Copy link
Member

Makes sense! I'll try to get this in before we cut 0.6, but it's going to be close. :)

@shantanugadgil
Copy link
Contributor

@schmichael ... just curios, how soon in 0.6 landing? 👍 😄

@schmichael
Copy link
Member

@shantanugadgil 🔜

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants