I’m working on getting my containers set up via name instead of ip in the Swag container proxy-conf files (so that it doesn’t matter when their IPs change if I have to reboot the server), and I’m running into an issue.
When using the container name as is default (sonarr
in this example), I get a “502 Nginx can not connect to the application” page in my browser (even after clearing cache), and this error in the Nginx error.log:
sonarr could not be resolved (3: Host not found), client: <my ip here>, server: _, request: "GET /sonarr/ HTTP/2.0", host: "mydomain.com", referrer: "https:/mydomain.com/sonarr/login?returnUrl=/sonarr/"
I also get the same issue when connecting directly to my Unraid server’s local IP/sonarr, so I don’t think it’s a domain name thing (I’m using Cloudflare - DNS off for testing currently)
When I edit the $upstream_app
to use the Sonarr container’s internal IP shown in Unraid 172.x.x.x, it works fine. (I’m just using the included sonarr.subfolder.conf
; this exact same issue also occurs when using nextcloud.subdomain.conf
so it’s not just a subfolder thing)
Running docker exec swag ping sonarr -c2
also works without issue:
PING sonarr (172.x.x.x): 56 data bytes
64 bytes from 172.x.x.x: seq=0 ttl=64 time=0.075 ms
64 bytes from 172.x.x.x: seq=1 ttl=64 time=0.065 ms
--- sonarr ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.065/0.070/0.075 ms
I’ve got a custom Docker network (named proxynet
) set up in Unraid as shown in SpaceInvador One’s video here (which is for the older Let’sEncrypt container but it seems to be similar), and Swag and Sonarr are both set up to use it. (Preserve user defined network:
is set to Yes, and I’ve rebooted to confirm)
Not entirely sure what I’m doing wrong here, or what else to look for, as it seems the containers can communicate (from ping), but Nginx isn’t resolving the name correctly. Any guidance would be greatly appreciated!