I have nginx in a docker container, and a nodejs webapp in another docker container. The nodejs server is reachable from the host server on port 8080.
The nginx docker c
Here's a best practice. Only expose port 80 outside of the host. The nodejs app can be in a private network only accessible through nginx.
version: "2"
services:
nginx:
...
ports:
- "80:80"
networks:
- backbone
nodejs:
...
networks:
- backbone
expose:
- 8080
networks:
backbone:
driver: bridge
In your nginx.conf file, the upstream servers can be listed as nodejs:8080
. The docker daemon will resolve it to the correct internal ip.