TrafeX/docker-php-nginx

Unable to set custom DNS

Closed this issue · 2 comments

Hi there,

I have a self-hosted Pi-hole instance that works fine and I would like to set it as DNS of a container based on this image. I've opened port 53 on my host too. I tried to add to my docker-compose.yml the dns key and setting the host IP address as its value but the container is still unable to resolve custom domains. I also tried to set the DNS inside the Docker daemon.json file but no luck. I don't know if this issue could be related to the base image you are using (Alpine). Could you help me? Thanks.

EDIT:
I forgot to write that the container is able to resolve custom domains listed into the extra_hosts key of my docker-compose.yml. By the way this is not a solution because I have to resolve wildcard domains which are not supported by extra_hosts.

Hi @goldmont,

I don't think this issue is related to this specific image. Setting a different DNS server is something you can do via the Docker configuration as explained here: https://dockerlabs.collabnix.com/intermediate/networking/Configuring_DNS.html
That will also change the DNS for all container.

Hi @goldmont,

I don't think this issue is related to this specific image. Setting a different DNS server is something you can do via the Docker configuration as explained here: https://dockerlabs.collabnix.com/intermediate/networking/Configuring_DNS.html That will also change the DNS for all container.

Hi, I solved.

I had to specify the host IP address in the ports attribute into Pi-hole's docker-compose.yml. Then I've set the dns attribute into docker-php-nginx's docker-compose.yml. Now it's working. Thank you.