Docker compose to ECS, two services in one task 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.
My ECS cluster looks like this atm.
What you are looking for is a sidecar pattern where you run a container of your main application and a number of additional containers (one or more) in support of it. This is a well established pattern with orchestrators such as ECS but it's not possible to declare it with a docker compose syntax today. There is an open request talking about this. Can I ask you to +1 it and add your commentary/request there? It would help Docker to sense demand for this feature. Thanks!