advancedScenario-Based & System Design Questions

A `docker compose up --scale api=3` command succeeds but only one of the three replicas ever receives traffic.

If `ports:` includes a fixed host port mapping, only the first replica can bind it successfully (the others fail to bind but might still report as running depending on configuration), so all traffic naturally lands on the one bound replica. Confirm by checking each replica's actual listening state, and fix by removing the fixed host port mapping and placing a load balancer or reverse proxy (e.g., nginx, Traefik) in front of the replicas to distribute traffic across all of them.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full DevOps Mastery library.

A `docker compose up --scale api=3` command succeeds but only one of the three replicas ever receives traffic.

Next Step

Continue to After enabling a Kubernetes Horizontal Pod Autoscaler based on CPU usage, replica count fluctuates rapidly up and down ('flapping') under moderately variable load.← Back to all Docker questions