Skip to content

Commit 3156b97

Browse files
authored
Fallback if container has no IP
Sometimes containers will not be assigned an IP (after reboot or due to misconfiguration). This leads to an incorrect "server <missing ip> down;" line in default.conf and crashes nginx. @therealgambo provided a fix for this: nginx-proxy#845
1 parent f05f7a0 commit 3156b97

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

nginx.tmpl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@
1313
{{ end }}
1414
{{ else if .Network }}
1515
# {{ .Container.Name }}
16-
server {{ .Network.IP }} down;
16+
{{ if .Network.IP }}
17+
server {{ .Network.IP }} down;
18+
{{ else }}
19+
server 127.0.0.1 down;
20+
{{ end }}
1721
{{ end }}
22+
1823
{{ end }}
1924

2025
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the

0 commit comments

Comments
 (0)