amazon/dynamodb-local Error: "Invalid directory for database creation"

0

While attempting to run this docker command docker run -p 8001:8001 amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb -dbPath $DATA_DIRECTORY -cors http://localhost:5173,http://localhost:3000

I receive a Invalid directory for database creation. error. I run the command above from a bash script:

DATA_DIRECTORY=$(realpath data)
docker run -p 8001:8001 amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb -dbPath $DATA_DIRECTORY -cors http://localhost:5173,http://localhost:3000

When I inspect the docker container I can see that the args passed are correct and the folder does exist. Not sure what I am doing wrong here. Enter image description here

Darrell
asked 3 months ago222 views
1 Answer
0

The -dbPath specifies the path in the container. Therefore, if you want to create it in a folder on your computer, you must share it with the container using the `-v' option.

For example, you can run the following.

docker run -p 8001:8001 -v $DATA_DIRECTORY:/home/dynamodblocal amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb -dbPath . -cors http://localhost:5173,http://localhost:3000
profile picture
EXPERT
shibata
answered 3 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions