1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-02-24 01:38:15 +00:00

Support containers running --net=host (#1537)

Detect if a target container is running host networking, and if so, use the IP address of the first bridge net gateway.
This commit is contained in:
Andy 2023-04-23 14:09:33 +01:00
parent b4efff04b7
commit 325fd01ebb

View File

@ -67,6 +67,11 @@
# {{ .Name }} (ignored)
{{- continue }}
{{- end }}
{{- if eq .Name "host" }}
# {{ .Name }} (host network; using {{ (index $.globals.CurrentContainer.Networks 0).Name }} gateway)
{{- $ip = (index $.globals.CurrentContainer.Networks 0).Gateway }}
{{- continue }}
{{- end }}
{{- if and (not (index $.globals.networks .Name)) (not $.globals.networks.host) }}
# {{ .Name }} (unreachable)
{{- continue }}