Hi all,
I am getting 502 errors after setting up swag following the original SIO video for letsencrypt. The issue seems to be that name lookup of the containers is failing.
I am using latest, but also tried with several other versions dating back to 1.8.0
I am using all sample configs with no modifications
portainer
nextcloud
grafana
swag and containers are all on custom docker network
nslookup finds the docker container by name
can ping one container from another
Using linuxserverio containers with default names
nginx error.log:
2021/06/05 20:21:54 [error] 470#470: *1 nextcloud could not be resolved (3: Host not found), client: 192.168.100.1, server: nextcloud.*, request: "GET / HTTP/2.0", host: "nextcloud.domain.com"
2021/06/05 20:43:08 [error] 406#406: *6 portainer could not be resolved (3: Host not found), client: 192.168.100.1, server: portainer.*, request: "GET / HTTP/2.0", host: "portainer.domain.com"
root@unRAID:/mnt/user/appdata/swag/nginx/proxy-confs# docker container list
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
40368254d154 linuxserver/swag "/init" 12 minutes ago Up 12 minutes 0.0.0.0:8081->80/tcp, 0.0.0.0:4443->443/tcp swag
0130fe9243c4 portainer/portainer "/portainer" About an hour ago Up 24 minutes 0.0.0.0:44344->9000/tcp portainer
nslookups:
root@40368254d154:/# nslookup portainer
Server: 127.0.0.11
Address: 127.0.0.11:53
Non-authoritative answer:
*** Can't find portainer: No answer
Non-authoritative answer:
Name: portainer
Address: 172.18.0.2
root@40368254d154:/#
root@40368254d154:/# ping portainer
PING portainer (172.18.0.2): 56 data bytes
64 bytes from 172.18.0.2: seq=0 ttl=64 time=0.161 ms
64 bytes from 172.18.0.2: seq=1 ttl=64 time=0.145 ms
^C
If I modify portainer.subdomain.conf as follows the 502 error goes away.
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app portainer;
set $upstream_port 9000;
set $upstream_proto http;
#proxy_pass $upstream_proto://$upstream_app:$upstream_port;
proxy_pass $upstream_proto://172.18.0.2:$upstream_port; # hard code ip
I wonder if nginx is choking on the first failed nslookup? Is that a docker network issue? Any other ideas?
Thanks in advance!