From ca6b32365440d9132093afd3f4ae9b15319b8c80 Mon Sep 17 00:00:00 2001 From: mitja Date: Thu, 6 Apr 2017 10:55:38 +0200 Subject: [PATCH 1/2] Added DEFAULT_IP env variable --- nginx.tmpl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nginx.tmpl b/nginx.tmpl index a5b1d32..9d8ba9c 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -9,11 +9,11 @@ {{/* If there is no swarm node or the port is not published on host, use container's IP:PORT */}} {{ else if .Network }} # {{ .Container.Name }} - server {{ .Network.IP }}:{{ .Address.Port }}; + server {{ .Network }}:{{ .Address.Port }}; {{ end }} {{ else if .Network }} # {{ .Container.Name }} - server {{ .Network.IP }} down; + server {{ .Network }} down; {{ end }} {{ end }} @@ -110,16 +110,17 @@ upstream {{ $upstream_name }} { {{ range $containerNetwork := $container.Networks }} {{ if eq $knownNetwork.Name $containerNetwork.Name }} ## Can be connect with "{{ $containerNetwork.Name }}" network - + + {{ $containerNetworkIp := or $container.Env.DEFAULT_IP $containerNetwork.IP }} {{/* If only 1 port exposed, use that */}} {{ if eq $addrLen 1 }} {{ $address := index $container.Addresses 0 }} - {{ template "upstream" (dict "Container" $container "Address" $address "Network" $containerNetwork) }} + {{ template "upstream" (dict "Container" $container "Address" $address "Network" $containerNetworkIp) }} {{/* If more than one port exposed, use the one matching VIRTUAL_PORT env var, falling back to standard web port 80 */}} {{ else }} {{ $port := coalesce $container.Env.VIRTUAL_PORT "80" }} {{ $address := where $container.Addresses "Port" $port | first }} - {{ template "upstream" (dict "Container" $container "Address" $address "Network" $containerNetwork) }} + {{ template "upstream" (dict "Container" $container "Address" $address "Network" $containerNetworkIp) }} {{ end }} {{ end }} {{ end }} From 8c37525cc4103d4c88cbe5ed3a3caab688ed0358 Mon Sep 17 00:00:00 2001 From: senzacionale Date: Tue, 11 Dec 2018 12:58:45 +0100 Subject: [PATCH 2/2] Change maintainer --- Dockerfile | 2 +- Dockerfile.alpine | 2 +- README.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6da4b03..2d87cc8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM nginx:1.11.10 -MAINTAINER Jason Wilder mail@jasonwilder.com +MAINTAINER Mitja Bombac mitja.bombac@gmail.com # Install wget and install/updates certificates RUN apt-get update \ diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 8715a2a..21e74b8 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -1,5 +1,5 @@ FROM nginx:1.11.10-alpine -MAINTAINER Jason Wilder mail@jasonwilder.com +MAINTAINER Mitja Bombac mitja.bombac@gmail.com # Install wget and install/updates certificates RUN apk add --no-cache --virtual .run-deps \ diff --git a/README.md b/README.md index 0b8191a..789c1cf 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,11 @@ Provided your DNS is setup to forward foo.bar.com to the a host running nginx-pr The nginx-proxy images are available in two flavors. -#### jwilder/nginx-proxy:latest +#### senzacionale/nginx-proxy:latest This image uses the debian:jessie based nginx image. - $ docker pull jwilder/nginx-proxy:latest + $ docker pull senzacionale/nginx-proxy:latest #### jwilder/nginx-proxy:alpine