Deploy Docker container in ECS using docker compose

Nidhi
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.

Prerequisite

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

Agenda:

  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'
services:
web:
image: public.ecr.aws/w0f5g4k6/javaweb:latest
ports:
- 8080

--

--