[Docker ECS] Detailed settings for docker compose up

At first

It describes how to make detailed settings with the docker compose up command that has recently become available.

Please refer to this article for the basics. [Introduction to Docker x ECS] Deploy ECS with docker compose up

Setting method

It is ok if you draw it in the docker-compose file. It's mostly as shown on the reference page (the details seem to be different).

version: "3"
services:
  front:
    image: [AWS_ID].dkr.ecr.ap-northeast-1.amazonaws.com/front:latest
    #--- AWS settings ---
    deploy:
      x-aws-autoscaling:
        min: 2
        max: 10
      resources:
        reservations:
          memory: 300Mb
    #--- AWS settings ---
    command: bash -c "yarn run build && yarn start"
    ports:
      - "3000:3000"
    depends_on:
      - back
  back:
    image: [AWS_ID].dkr.ecr.ap-northeast-1.amazonaws.com/back:latest
    command: rails s -p 3001 -b 0.0.0.0
    ports:
      - "3001:3001"

By the way, if you want to specify vpc, you can do as follows. By doing this, RDS, elasticache, etc. can be created in advance.

version: "3"
x-aws-vpc: [VPC_ID]
services:
  front: #Abbreviation
  back: #Abbreviation

Reference page

-Setting example -Settable items

Recommended Posts

[Docker ECS] Detailed settings for docker compose up
[Introduction to Docker x ECS] ECS deployment with docker compose up
Measures for insufficient memory capacity of docker compose build
Php settings with Docker
A story about speeding up unittest on Docker for Mac