I am using Nginx as a reverse proxy on a docker container. Docker should have internal DNS which resolves container names by finding their ip address.
From the Nginx container if I use ping apache
, docker resolves the ip address and the container with apache replies.
If I use the following address, in the nginx configuration it doesn't work and I get 502 bad gateway
. I have to manually specify the ip of the docker apache container.
proxy_pass http://apache:8080$request_uri;
Do you have any ideas?
I solved by using this line to set docker dns as resolver within nginx config.
resolver 127.0.0.11;
However I'm not sure that docker dns address won't change over time.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.