Posts

Showing posts with the label Docker Compose

Auto Create S3 Buckets On Localstack

Answer : A change that came in with this commit since version 0.10.0 . When a container is started for the first time, it will execute files with extensions .sh that are found in /docker-entrypoint-initaws.d . Files will be executed in alphabetical order. You can easily create aws resources on localstack using awslocal (or aws) cli tool in the initialization scripts. version: '3.7' services: localstack: image: localstack/localstack environment: - SERVICES=s3 ports: - "4572:4572" volumes: - ./aws:/docker-entrypoint-initaws.d With a script in directory ./aws/buckets.sh : #!/bin/bash set -x awslocal s3 mb s3://bucket set +x Note: the set [-/+] x is purely there to turn on and off outputting of the commands being executed. Will produce this output: ... localstack_1 | Starting mock S3 (http port 4572)... localstack_1 | Waiting for all LocalStack services to be ready localstack_1 | Ready. localstack_1 | /...