docker-compose for nginx and nodejs server
You use the container's name
as you defined it in docker-compose.yml
. Docker provides the IP addresses for the named containers via DNS within each container, and updates them if the containers are updated.
In this case, you called it server
, so that is what you would use.
proxy_pass http://server:8000;
Documentation: Networking in Compose