3
3

More than 3 years have passed since last update.

LocalStack起動時にS3バケットを作成する (docker-compose)

Last updated at Posted at 2021-01-29

フォルダ構成

tree
├── docker-compose.yml
└── localstack
    └── init_s3.sh

docker-compose

volumes./localstack/docker-entrypoint-initaws.d へ割り当てる
これにより ./localstack/*.shdocker-compose up 時に実行される

docker-compose.yml
services:
  localstack:
    container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
    image: localstack/localstack
    network_mode: bridge
    ports:
      - "4566:4566"
      - "4571:4571"
      - "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"
    environment:
      - SERVICES=${SERVICES- }
      - DEBUG=${DEBUG- }
      - DATA_DIR=${DATA_DIR- }
      - PORT_WEB_UI=${PORT_WEB_UI- }
      - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR- }
      - KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
      - DOCKER_HOST=unix:///var/run/docker.sock
      - HOST_TMP_FOLDER=${TMPDIR}
    volumes:
      - ./localstack:/docker-entrypoint-initaws.d # ここ

shell

./localstack/init_s3.sh にバケット作成コマンド

init_s3.sh
#!/bin/bash
awslocal s3 mb s3://hoget

おわり

3
3
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
3
3