8000 bug: Volume Mount Creates Directory Instead of File for Init Hook Script · Issue #12618 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content
bug: Volume Mount Creates Directory Instead of File for Init Hook Script #12618
Closed as not planned
@vishnusureshperumbavoor

Description

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When attempting to mount a shell script (init-aws.sh) as a volume to /etc/localstack/init/ready.d/init-aws.sh within the LocalStack container (as per the official documentation), Docker creates a directory named init-aws.sh instead of a file.

Image

Expected Behavior

The init-aws.sh script should be successfully mounted into the LocalStack container and executed during startup. This should result in the creation of an S3 bucket and a DynamoDB table as defined in the script.

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

  1. Folder structure
localstack
     |_________init-aws.sh
docker-compose.yml
  1. Run executable command as per documentation
cd localstack
chmod +x init-aws.sh
  1. Add the following code in init-aws.sh file
#!/bin/bash

export AWS_ACCESS_KEY_ID=000000000000 AWS_SECRET_ACCESS_KEY=000000000000

awslocal s3 mb s3://my-bucket
awslocal sqs create-queue --queue-name my-queue
  1. Add following code in docker-compose.yml
services:
 localstack:
   container_name: "localstack-main"
   image: localstack/localstack
   ports:
     - "127.0.0.1:4566:4566"
   environment:
     - DEBUG=1
   volumes:
     - "/localstack/init-aws.sh:/etc/localstack/init/ready.d/init-aws.sh" 
     - "./volume:/var/lib/localstack"
     - "/var/run/docker.sock:/var/run/docker.sock"
  1. Run docker-compose up
  2. Inspect the contents of /etc/localstack/init/ready.d inside the running LocalStack container (e.g., using docker exec -it localstack-main ls -l /etc/localstack/init/ready.d). You will observe that init-aws.sh is a directory, not a file.

Environment

- OS: Ubuntu 22.04.5
- LocalStack:
  LocalStack version: 4.4.1.dev13
  LocalStack Docker image sha: sha256:77bb976657d31a9da577b287909dab12dc412a2d7af218caf915be71ab931773
  LocalStack build date: 2025-05-14
  LocalStack build git hash: 9b6ef35c7

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0