-
Notifications
You must be signed in to change notification settings - Fork 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
Support containers running --net=host (#1537) #2222
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Detect if a target container is running host networking, and if so, use the IP address of the first bridge net gateway.
71c8de5
to
325fd01
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
In the initial issue (#1537), the issue creator also run the proxy in host network mode networking. I don't know if running the proxy in bridge network mode and the proxied containers in host network mode is a common use case in the issues related to this. I think that people are most likely to run everything in host network mode rather than just a few containers but I might be wrong. |
Not sure if they particularlly wanted to run the proxy in host mode, or if it was just a way of trying to get it working with homeassistant (which has to run in a host mode container if you want it to do a load of network discovery). This is my exact use case too - I want to proxy to several containers running in a 'normal' bridge mode, and also to homeassistant running in host mode. I feel like most folks would want to keep bridge networking wherever possible, as it's part of the segregation benefits of containerisation, but I have no evidence to back up this assertion! |
That does work with the proxy in bridge network mode and the container in host network mode. It requires Ideally I would also like it to be tested. |
I added a minimal test. @rhansen I'd like your advice on this, should we work a bit more on this feature (support proxy + container in host network mode, warn if |
I'll take a look when I have some time next week. I'm OK with marking this as experimental while we continue to evaluate. |
604d6ce
to
15c738f
Compare
15c738f
to
b88d33d
Compare
@rot169 just to be sure: for a given container, host network mode and the other network modes are all mutually exclusive ? |
I added the following to the PR:
@rhansen I'd still like your review on this, the template code might be sub optimal. Other than that I'm okay with the PR in its current state. @rot169 could you test the PR in its current state ? |
That's correct; as far as I understand it is not possible to have a container with both host-based network and a bridge network.
Sure, will probably take me a few days, but will do so and report back. |
I'm tempted to use |
For my workaround with Home Assistant container being host networked, I used qoomon/docker-host. The same solution is what I suspect people are using to make nginx-proxy handle non-dockerized applications. I don't like the approach, but it has worked for me. The proposed pull req commits looks great, and while I figure out how to build my own image based off this pull req, I will give a friendly ping to @rot169 if they've done their testing yet. |
Thanks for the ping - and apologies this'd dropped off my radar. Yes, the latest code seems to work great for me, and is clearly more robust than my initial proposal. |
I spotted a typo in the doc I added, I'll fix this then probably merge this PR by the end of the week. |
Nice! Looks like a little oops in Markdown |
Fixed, thank you @prashker |
Thank you - sorry for the LONG delay. I can confirm this functionality works. My Good riddance to my workaround! |
Containers which run host networking do not have their own IP address, which means the template doesn't know what to use as the upstream server. This change detects if a target container is running host networking, and if so, uses the IP address of the bridge net gateway as the upstream target.
Fixes #1270
Fixes #832