How to make nginx to resolve DNS names to the host machine?

Hello,

We are already using fairly simple Docker in development environment just to manage service dependencies but the current task seems to be much more complicated.

In order to introduce multitenancy into our app, we would like to have a dynamic 3rd level domain name resolution with request dynamically proxied to the host machine.

Here is what I’m thinking about

Point domains to the Docker VM in the host’s /etc/hosts file :
192.168.64.3 john.app.dev mary.app.dev. bob.app.dev app.dev (using DLite here)

Add dnsmasq which will resolve those domain to the host IP:

192.168.64.1 john.app.dev mary.app.dev. bob.app.dev app.dev

Make NGINX to resolve hosts via linked dnsmasq container:
server { listen 80; server_name app.dev; resolver 127.0.0.1; }

Is it a correct (idiomatic) way to do that kind of thing?

1 Like

Hmmm good question. :hourglass_flowing_sand:

Try: resolver 127.0.0.11 valid=10s;