Deploy Docker container in ECS using docker compose

2 min readApr 23, 2021

In this blog, we will deploy a container using docker-compose in ECS cluster.

You can follow this blog to deploy a docker container in ECS directly.


  1. Configure aws credential
  2. Install aws cli version 2
  3. Clone this git repo


  1. Create new docker context
  2. Run docker compose to create a new ECS cluster

To run it from your local workstation, first you need to set the docker context to use the ECS to run the docker commands

Create new docker context

docker context create ecs myecs
docker context ls
docker context use myecs

Create a docker-compose.yaml file and provide your image detail

version: '3.4'
- 8080

Below command will create a ECS cluster with all other components which are required for the application like

  • ECS Cluster
  • VPC & Security Groups
  • Task Definitions
  • Tasks
  • Service
  • Load Balancer
  • Target Groups
docker compose up

NOTE: For this error unexpected status code [manifests latest]: 403 Forbidden

Make sure you have logged in for your ECR repository

Cluster name is created as per your project name.