My first webserver (without Docker) is listening on http://127.0.0.1:5000. I have an nginx proxy (Docker) to forward d5000.local:80 to http://127.0.0.1:5000. My hosts file maps the domain to the IP:
#etc/hosts
127.0.0.1 d5000.local
Now I run curl -v http://d5000.local
on my host. And everything works fine.
I have an second webserver in a docker container (bridged network) on my development machine. If I go into the container and run curl -v http://d5000.local
I get a response from the second webserver instead from the first webserver. It seems that the container is using the hosts file of the host. The container requests its own lookup address instead the lookup address of the host.
How can I request the webserver on the host from my docker container by domain name (d5000.local)? Do I need a DNS? What is the best practise for a development machine?
Details: I need to call the first webserver from my browser and from the second webserver with the same address. It is an OAuth-Server with a front- and a backchannel.