From b61c84192960d937a5e5b517264efe9653f8f899 Mon Sep 17 00:00:00 2001 From: Harald Wellmann Date: Thu, 22 Mar 2018 10:56:41 +0100 Subject: [PATCH] do not create an empty upstream entry for a container from an invisible Docker network --- nginx.tmpl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nginx.tmpl b/nginx.tmpl index 6bf19d5..1d1d4b6 100644 --- a/nginx.tmpl +++ b/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 }}