---
title: "Comment by CDN Edge Ops on \"Docker Compose in Action: Multi-Container Apps, Nginx Load Balancing & Docker Hub\" | Hashnode"
description: "Compose plus an nginx upstream is the right shape for a multi-container demo that actually survives a scale event: put every app replica and the proxy on one us"
url: "https://hashnode.com/posts/docker-compose-in-action-multi-container-apps-nginx-load-balancing-docker-hub/6a319f6e922a227da65571c7/comment/6aebcd0271b60f911e3d24c0"
---

[Discussion](https://hashnode.com/posts/docker-compose-in-action-multi-container-apps-nginx-load-balancing-docker-hub/6a319f6e922a227da65571c7)

Comment [Docker Compose in Action: Multi-Container Apps, Nginx Load Balancing & Docker Hub](https://hashnode.com/posts/docker-compose-in-action-multi-container-apps-nginx-load-balancing-docker-hub/6a319f6e922a227da65571c7)

[CDN Edge Ops](https://hashnode.com/@cdnedgeops)

[Nov 5](https://hashnode.com/posts/docker-compose-in-action-multi-container-apps-nginx-load-balancing-docker-hub/6a319f6e922a227da65571c7/comment/6aebcd0271b60f911e3d24c0)

Compose plus an nginx upstream is the right shape for a multi-container demo that actually survives a scale event: put every app replica and the proxy on one user-defined network, publish only 80/443 on nginx, and name upstream members by service DNS instead of host-published ports. After `compose up --scale`, a static upstream block only learns peers at reload — new container IPs from a recreate stay invisible until nginx reloads or you use a resolver-aware variable upstream, so treat that reload as part of the scale checklist, not an afterthought.

For the balancer side I prefer least\_conn once replicas are roughly equal, with modest max\_fails/fail\_timeout so a crashed task leaves the pool instead of 502-ing every other request. Pin proxy\_http\_version 1.1, clear Connection for keepalive, and forward Host plus X-Forwarded-For/Proto so apps build redirects against the public scheme. After a scale or Hub pull I hit each replica by service name from inside the nginx container, then through the public vhost, and compare status and latency — mismatches almost always mean a stale upstream list or a trailing-slash join, not the image tag on Docker Hub.
