Below is a simplified version of my docker-compose.yml
file.
I can understand or find any resources to tell me which container of the 5 django
replicas the nginx container will target if i reference it.
For example, as you can see if my compose file I have one instance of Nginx and five of Django.
If my nginx config i have an upstream like this:
upstream docking_django {
server web:3000;
}
Which web container will the upstream come from? Will it load balance between them? I'm deploying to AWS ECS and when I try running it, it seems like it's load balancing somehow. But I would like to understand it further since it doesn't seem to behave the same way always.
version: '3.9'
services:
web:
image: .dkr.ecr.eu-west-3.amazonaws.com/tin-api-v2/django:${IMAGE_TAG}
build:
context: .
dockerfile: ./Dockerfile
networks:
- demoapp
deploy:
replicas: 5
nginx:
image: .dkr.ecr.eu-west-3.amazonaws.com/tin-api-v2/nginx:${IMAGE_TAG}
build:
context: .
dockerfile: ./nginx.Dockerfile
ports:
- 80:80
depends_on:
- web
networks:
- demoapp
deploy:
replicas: 1
networks:
demoapp: