Skip to content

Conversation

pini-gh
Copy link
Contributor

@pini-gh pini-gh commented Sep 30, 2023

The purpose of this pull request is to add the Internal property to the Network structure so that it could be used to fix nginx-proxy/nginx-proxy#2310.

I've tested that this change makes the fix for the nginx-proxy related issue easy:

diff --git a/nginx.tmpl b/nginx.tmpl
index fb0766b..afe5c96 100644
--- a/nginx.tmpl
+++ b/nginx.tmpl
@@ -75,7 +75,7 @@
                 {{- continue }}
             {{- end }}
             {{- range sortObjectsByKeysAsc $.globals.CurrentContainer.Networks "Name" }}
-                {{- if and . .Gateway }}
+                {{- if and . .Gateway (not .Internal) }}
     #         container is in host network mode, using {{ .Name }} gateway IP
                     {{- $ip = .Gateway }}
                     {{- break }}

I have no knowledge in Go programming and it took me quite some time to come up with this proposal. Please bear with me :)

@buchdag
Copy link
Member

buchdag commented Dec 9, 2023

Nice !

@buchdag buchdag merged commit 2c58e80 into nginx-proxy:main Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken testcase test/test_host-network-mode/test_host-network-mode.py
2 participants