I have a docker-compose.yml file like this:
version: "3"
x-aws-vpc: 'vpc-xxx'
x-aws-loadbalancer: 'arn:aws:elasticloadbalancing:us-east-1:xxx:loadbalancer/app/xxx'
services:
api:
image: image/xxx
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost/health || exit 1"]
environment:
- PORT=80
- REDIS_URL=redis://redis:6379
env_file:
- ./.env
expose:
- 80
depends_on:
- redis
deploy:
x-aws-autoscaling:
min: 1
max: 4
cpu: 75
networks:
- alb
redis:
image: redis
container_name: redis
restart: unless-stopped
expose:
- 6379
command: ["redis-server", "--appendonly", "yes"]
networks:
- alb
networks:
alb:
external: true
name: "sg-xxx"
I created a load balancer myself so it would get created in specific subnets.
When I run the command docker compose up, the ECS cluster gets created correctly but there is no link created between the Load Balancer and the services. When updating the service, it says:
Elastic load balancing not configured. Load balancing settings can only be set on service creation.
I also tried to create a Target Group manually, but still nothing gets added to the targets.