I'm using this method to deploy my docker-compose project to AWS ECS.
A simplified version of my docker-compose.yml looks like this:
version: '3'
services:
web:
image: .dkr.ecr.eu-west-3.amazonaws.com/django:${IMAGE_TAG}
build:
context: .
dockerfile: ./Dockerfile
nginx:
image: .dkr.ecr.eu-west-3.amazonaws.com/nginx:${IMAGE_TAG}
build:
context: .
dockerfile: ./nginx.Dockerfile
ports:
- 80:80
depends_on:
- web
So, run docker compose up
with my AWS ECS context and it works beautifully, cloud-formation creates all my resources and so on.
But, I can't figure out how to get these two services (web and nginx) to run in one task. Since they are in separate tasks at the moment it will create two instances of FARGATE or EC2 which is a bit overkill. I'd like two run the two containers on one instance but be able to scale up to more duplicate instances.
As stated in the link attached, I can modify the cloud-formation template to my liking, but something are limited to what I can modify. I don't think I can move that container service to another task since the image tag etc are created dynamically by docker compose
.