nginx container unable to pick the container's /etc/hosts file
I'm using image: nginx:1.21.6-alpine
This was already closed here but It is still not working.
When I do proxy_pass in nginx.conf I get "host not found"
https://github.com/nginxinc/docker-nginx/issues/284
I'm passing the extra_hosts: in the docker-compose.yml file + I checked and the entries are added in the docker image's /etc/hosts file + I checked and both ping and curl are working inside the docker image.
Inside the nginx.conf I tried both with the resolver directive and without the resolver directive and nothing is working.
For the resolver directive I tried with both resolver 127.0.0.11 ipv6=off; and resolver 127.0.0.53 ipv6=off; and still not work.
I also tried to bind mount the /etc/hosts from the host machine to the /etc/hosts inside docker and I made sure that the /etc/hosts file on the host contains the correct entries but still no luck.
I also tried network_mode to "host" in docker-compose.yml + I made sure that the /etc/hosts file on the host contains the correct entries but still no luck.
Hello @distributev!
It would help if you could provide exact steps to reproduce the issue:
- what docker versions on what OS you're using
- docker-compose version
- full configurations and command line launches you're using.
You may also try the test case as per https://github.com/nginxinc/docker-nginx/issues/284#issuecomment-789019391 to check if it works for you.
Closing due to feedback timeout.