フォルダ構成
tree
├── docker-compose.yml
└── localstack
└── init_s3.sh
docker-compose
volumes
で ./localstack
を /docker-entrypoint-initaws.d
へ割り当てる
これにより ./localstack/*.sh
が docker-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
おわり