diff --git a/Dockerfile b/Dockerfile index 45a09e3..0d32206 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM nginx:1.14.1 -LABEL maintainer="Jason Wilder mail@jasonwilder.com" +LABEL 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 23459a3..526c21e 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -1,5 +1,5 @@ FROM nginx:1.14.1-alpine -LABEL maintainer="Jason Wilder mail@jasonwilder.com" +LABEL 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 a6504cd..8945fea 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,11 @@ Provided your DNS is setup to forward foo.bar.com to the host running nginx-prox 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 diff --git a/nginx.tmpl b/nginx.tmpl index d861050..141ce61 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -9,17 +9,12 @@ {{/* 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 }} - {{ if .Network.IP }} - server {{ .Network.IP }} down; - {{ else }} - server 127.0.0.1 down; - {{ end }} + server {{ .Network }} down; {{ end }} - {{ end }} # If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the @@ -129,22 +124,20 @@ upstream {{ $upstream_name }} { {{ range $knownNetwork := $CurrentContainer.Networks }} {{ range $containerNetwork := $container.Networks }} - {{ if (and (ne $containerNetwork.Name "ingress") (or (eq $knownNetwork.Name $containerNetwork.Name) (eq $knownNetwork.Name "host"))) }} + {{ if eq $knownNetwork.Name $containerNetwork.Name }} ## Can be connected 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) }} - {{ end }} - {{ else }} - # Cannot connect to network of this container - server 127.0.0.1 down; + {{ template "upstream" (dict "Container" $container "Address" $address "Network" $containerNetworkIp) }} + {{ end }} {{ end }} {{ end }} {{ end }}