I've put together a docker-compose file with 2 services (php:8.0-fpm-alpine and nginx:stable-alpine) within the same network as nginx-proxy-manager and have a proxy host record pointing to the name of the nginx service. I have found that sometimes when I run docker-compose down and then docker-compose up -d I may get a 502 error. This does disappear after a while which I believe matches up with my findings.
I have found that when running docker network inspect NETWORKNAME between each time I run the above commands I have noticed that the 502 error happens when the IP address of the nginx container changes and then the error goes away once DNS has re-cached its IP address from the service name. I've also noticed that I can disable then re-enable the proxy record to resolve the 502 error which I believe triggers an nginx reload in the proxy manager.
I'm not sure if the IP address should always be the same therefore a potential bug/issue with docker or something can be done in reverse-proxy-manager to ensure that the IP address that is mapped to the service name is updated when a 502 happens. Maybe something in cron to re-cache the IP addresses for all the proxy records every 3-5 minutes would help to diminish the issue.
I'm using Docker 20.10.6 on a Raspberry Pi 4 (Raspberry Pi OS - Buster 32bit).
I've put together a docker-compose file with 2 services (php:8.0-fpm-alpine and nginx:stable-alpine) within the same network as nginx-proxy-manager and have a proxy host record pointing to the name of the nginx service. I have found that sometimes when I run
docker-compose down
and thendocker-compose up -d
I may get a 502 error. This does disappear after a while which I believe matches up with my findings.I have found that when running
docker network inspect NETWORKNAME
between each time I run the above commands I have noticed that the 502 error happens when the IP address of the nginx container changes and then the error goes away once DNS has re-cached its IP address from the service name. I've also noticed that I can disable then re-enable the proxy record to resolve the 502 error which I believe triggers an nginx reload in the proxy manager.I'm not sure if the IP address should always be the same therefore a potential bug/issue with docker or something can be done in reverse-proxy-manager to ensure that the IP address that is mapped to the service name is updated when a 502 happens. Maybe something in cron to re-cache the IP addresses for all the proxy records every 3-5 minutes would help to diminish the issue.
I'm using Docker 20.10.6 on a Raspberry Pi 4 (Raspberry Pi OS - Buster 32bit).