1đź‘Ť
The localhost IP 127.0.0.1
inside your nginx only refers internally to the nginx container. There are a couple of solutions to this, either:
-
The simple thing is to run your nginx container in “host-mode networking” mode. At this point,
127.0.0.1
actually refers to your container host and it should all be good. See the docs, but basically just adding--network="host"
should work. The downside with this simplicity is that it’s slightly less secure. -
Alternatively, you can use “linked” containers, see the docs where you want the
--link
option. This way, from inside the nginx container you can use DNS resolution to access a different container, so you’d update yourproxy_pass
to the linked name. As a side note, doing this from docker-compose makes things considerably easier.