Skip to content

Conversation

propella
Copy link

This fix allows very useful Dockerized DynamoDBLocal to accept dbPath option to keep data persistent. The current docker mode works differently from local jar mode in two places:

  • dbPath option doesn't work with docker: true option because DynamoDBLocal writes files inside the container.
  • dynamodb.stop() doesn't stop DynamoDBLocal because -d option in docker run command keeps the container running.

To make docker mode work as same way as local jar, we need to mount the dbPath directory to the container, and to remove -d option like this:

docker run -p 8000:8000 amazon/dynamodb-local --mount type=bind,source=$(dbPath),target=/home/dynamodblocal/dbpath -jar DynamoDBLocal.jar -port 8000 -sharedDb -dbPath=dbpath

/home/dynamodblocal/dbpath is arbitrary directory name inside the container while dbPath is specified by the user.

propella added a commit to propella/serverless-dynamodb-local that referenced this pull request Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant