I have a set of Docker containers which right now uses a php-fpm image to host one app, and an nginx container which right now provides access to that one app. I have a third container which periodically uses curl to strobe a URL within that container. This command right now uses the hostname nginx. (The image is based on alpine:latest ...)
/usr/bin/curl --silent -i http://nginx/secret_url ...
Now, I want to use nginx_proxy to allow me to run more than one application container. But, now, how will the curl commands know how to send the request via the nginx_proxy to the proper application-container? How would there be name-resolution?
... or, does it matter? If curl simply issues a request on the internal Docker network (shared by nginx_proxy) attempting to connect to "port 80," and it specifies whatever URL it chooses, will the request nonetheless arrive at the proxy, which is then responsible for resolving the virtualhost name ... which I know that it will do ...? What I'm wondering is how the curl request is actually going to get to the web-server. Am I simply confusing myself?
Is it, for example, the case that the nginx in the URL cited above could actually be anything?
I wound up specifying the IPV4_ADDRESS of the nginx-proxy container (within the Docker bridged-network), then specifying this in an /etc/hosts file which I uploaded to the cronjob container.
It is important that, whereas the /etc/hosts in the container-host environment should probably specify 127.0.0.1, that will not work in a container. The container sees only "its" network, and so from its point-of-view 127.0.0.1 would refer literally to the container itself.