Skip to content

Commit

Permalink
Support containers running --net=host (#1537)
Browse files Browse the repository at this point in the history
Detect if a target container is running host networking, and if so, use the IP address of the bridge net gateway.
  • Loading branch information
rot169 committed Apr 19, 2023
1 parent b4efff0 commit 71c8de5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
# {{ .Name }} (ignored)
{{- continue }}
{{- end }}
{{- if eq .Name "host" }}
# {{ .Name }} (host network; using gateway)
{{- $ip = $globals.CurrentContainer.Gateway" }}
{{- continue }}
{{- end }}
{{- if and (not (index $.globals.networks .Name)) (not $.globals.networks.host) }}
# {{ .Name }} (unreachable)
{{- continue }}
Expand Down

0 comments on commit 71c8de5

Please sign in to comment.