0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【docker ECS】docker compose up の詳細設定

Last updated at Posted at 2020-12-25

最初に

最近使えるようになった docker compose up コマンドでの細かい設定の方法を記載しています。

基本的なことはこちらの記事を参考にしてください。
【Docker × ECS 入門】docker compose up で ECS デプロイ

設定方法

docker-compose ファイルに描き込めばokです。大体は参照ページのとおりです(細かい部分は違うようです)。

version: "3"
services:
  front:
    image: [AWS_ID].dkr.ecr.ap-northeast-1.amazonaws.com/front:latest
    # ーーーAWS設定ーーー
    deploy:
      x-aws-autoscaling:
        min: 2
        max: 10
      resources:
        reservations:
          memory: 300Mb
    # ーーーAWS設定ーーー
    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"

ちなみにvpcを指定したいときは以下のようにすればok。こうすればRDSやelasticacheなどなどは事前に作成可能です。

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

参考ページ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?