I have setup a web service in a Docker container such that it only responds to HTTP requests made to http://pouac.localhost.
So, currently, when I want to test this Docker container, I have to manually add the IP address of that container to the /etc/hosts
file of the host. This IP address changes from one run to another, so I need to get it every time with:
docker inspect mycontainer
... and then add it to /etc/hosts
.
It works, but it's a real pain. I'm pretty sure there is a better way to do it.
If I understand correctly, Docker includes a DNS server. So I guess I could try to point the host to the Docker DNS, and that would be a start... but I have no idea at which address runs the Docker DNS.
For information, the host is running Ubuntu 16.04, while the Docker containers are started with docker-compose
.