Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerized DynamoDBLocal accepts dbPath option #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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