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
已提問 4 個月前檢視次數 273 次
1 個回答
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
專家
shibata
已回答 4 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南