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

No upstreams generated when container has it's own IP #1937

Open
exander77 opened this issue Apr 2, 2022 · 1 comment
Open

No upstreams generated when container has it's own IP #1937

exander77 opened this issue Apr 2, 2022 · 1 comment
Labels
kind/bug Issue reporting a bug

Comments

@exander77
Copy link

exander77 commented Apr 2, 2022

I have containers with their own IPs assigned (so they are not using the host network), the IP is not detected and VIRTUAL_PORT is ignored. Would be great to at least set upstream by an environment variable.

@exander77
Copy link
Author

exander77 commented Apr 3, 2022

I solved this by this patch to support VIRTUAL_ADDRESS:

diff --git a/nginx.tmpl b/nginx.tmpl
index 610edf1..919c05d 100644
--- a/nginx.tmpl
+++ b/nginx.tmpl
@@ -135,6 +135,12 @@ location {{ .Path }} {
                        {{ end }}
                {{ end }}
        {{ end }}
+       {{ range $container := .Containers }}
+       {{ if $container.Env.VIRTUAL_ADDRESS }}
+       {{ $server_found = "true" }}
+       server {{ $container.Env.VIRTUAL_ADDRESS }}:{{ $container.Env.VIRTUAL_PORT }};
+       {{ end }}
+       {{ end }}
        {{/* nginx-proxy/nginx-proxy#1105 */}}
        {{ if (eq $server_found "false") }}
         # Fallback entry

@buchdag buchdag added the kind/bug Issue reporting a bug label Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issue reporting a bug
Projects
None yet
Development

No branches or pull requests

2 participants