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:
parent
b4efff04b7
commit
325fd01ebb
1 changed files with 5 additions and 0 deletions
|
@ -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 }}
|
||||
|
|
Loading…
Reference in a new issue