Trying to setup LocalStack for local development in a project that will be using aws services down the line. Trying to set it up for s3 and sqs, but it fails during setup.
I used this example for docker compose as a template, but still cannot get it to work. https://docs.localstack.cloud/references/init-hooks/#usage-example
Running on a Windows machine, using Docker Desktop.
Here is the log from inside the localstack container.
docker-compose.yml
version: '3.8'
name: test
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME:-localstack-main}"
image: localstack/localstack:latest
command: chmod +x /etc/localstack/init/ready.d/init-localstack.sh
ports:
- "4566:4566"
environment:
- DEBUG=1
volumes:
- "./init-localstack.sh:/etc/localstack/init/ready.d/init-localstack.sh"
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
init-localstack.sh
#!/bin/bash
awslocal s3 mb s3://my-bucket
awslocal sqs create-queue --queue-name my-queue
This seems like such a basic copy paste from the example in the docs, so its odd to me that the shell file cannot be executed.
I know I can get it to work by running commands from within the container manually, but this is not viable at scale, so would want it to work via compose.
I've encountered the same error in starting LocalStack and executing the script only when the CRLF
was still set for the init-localstack.sh
file.
I recommend recreating the init-localstack.sh
and ensuring that the LF lines
endings are correctly set. This can be done in VSCode or Notepad++.
The SERVICES
variable can be disregarded since it is not required. LocalStack initiates services with lazy loading, eliminating the need for this variable.