2
0
Эх сурвалжийг харах

do not create an empty upstream entry for a container from an invisible Docker network

Harald Wellmann 7 жил өмнө
parent
commit
b61c841929
1 өөрчлөгдсөн 3 нэмэгдсэн , 0 устгасан
  1. 3 0
      nginx.tmpl

+ 3 - 0
nginx.tmpl

@@ -142,6 +142,9 @@ upstream {{ $upstream_name }} {
 					{{ $address := where $container.Addresses "Port" $port | first }}
 					{{ template "upstream" (dict "Container" $container "Address" $address "Network" $containerNetwork) }}
 				{{ end }}
+			{{ else }}
+				# Cannot connect to network of this container
+				server 127.0.0.1 down;
 			{{ end }}
 		{{ end }}
 	{{ end }}