0

I have two dockerized apps, each consisting of an nginx + php-fpm container sitting behind another nginx proxy container. Both apps I can access via a locally defined hostname, say domain-1.dev and domain-2.dev. Here's my hosts file:

10.0.75.1 domain-1.dev domain-2.dev

None of the containers are linked beyond defining the VIRTUAL_HOST=... env variable in each of the nginx containers as required by the jwilder/nginx-proxy image I'm using for the proxy:

https://github.com/jwilder/nginx-proxy

Therefore from a browser on the host I can access each of the domains and get served php files in their relevant php-fpm containers.

Question: what do I need to setup to be able to curl one domain from another, e.g. to curl domain-1.dev from within the php-fpm container of the domain-2.dev app?

At the moment I'm getting cURL error 7: Failed to connect to domain-2.dev port 80: Connection refused

David
  • 145
  • 1
  • 2
  • 7
  • Is your app listening on port 80 inside the container? – BMitch Feb 01 '17 at 23:18
  • Yes, as I said, I can access both apps through a browser on the host. The nginx proxy container is exposing it's port 80 and forwarding the traffic to the relevant app by using the `VIRTUAL_HOST` config. Neither of the apps expose any ports. – David Feb 01 '17 at 23:25
  • I understand that nginx is exposed on port 80, I'm asking about the port that is listening on domain-1.dev and domain-2.dev, is the app inside of those containers listening on port 80? – BMitch Feb 01 '17 at 23:28
  • Got ya - yes, they are listening on 80 and 443. The PORTS section confirms `80/tcp, 443/tcp` for both apps. – David Feb 01 '17 at 23:34
  • From inside domain-1.dev, what ip does domain-2.dev resolve to, the docker host, nginx, or the other container? – BMitch Feb 01 '17 at 23:37
  • It resolves to 127.0.53.53, so I guess neither of the above. – David Feb 01 '17 at 23:45
  • @David: I have the same scenario (services behind the proxy, accessible from host, but having trouble to query one container service from another container via the host). Did you ever find a way to get this to work in a sane manner? Thanks in advance for any help. – haylem Oct 25 '17 at 14:36
  • Are they on the same docker network? – Btuman Feb 01 '18 at 22:11

0 Answers0