question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to best send command line args to local dynamodb docker container

See original GitHub issue

Sorry if this is the wrong git repo - I couldn’t find where the dockerfile for amazon/dynamodb-local was being maintained.

2 questions here:

  1. Currently, to send command line args as described here https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.UsageNotes.html it looks like I need to send the full args to the java process instead of just the args to configure the dynamodb server. So instead of running docker run -it --rm amazon/dynamodb-local -sharedDb I need to run docker run -it --rm amazon/dynamodb-local -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb Would it be possible to change the entrypoint/cmd of the dockerfile to handle the java args for you and the user just pass in the extra arguments? I think the more common use case is to just specify the dynamodb args, but if a user wanted to modify the java args they should be able to override the entrypoint in their own docker run

  2. What directory in the container should I mount if I want to persist the .db file?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:13
  • Comments:14

github_iconTop GitHub Comments

32reactions
houndedcommented, Sep 19, 2018

Great work @dferretti-fig ! for those that want it I have created a docker-compose file off those findings

version: '3'

services:
  dynamo:
    image: amazon/dynamodb-local
    environment:
      - ./Djava.library.path=./DynamoDBLocal_lib
    ports:
      - "8000:8000"
    volumes:
      - <directory>:/home/dynamodblocal/data
    working_dir: /home/dynamodblocal
    command: ["-jar", "DynamoDBLocal.jar", "-sharedDb", "-dbPath", "./data"]
24reactions
dferretticommented, Sep 6, 2018

After some digging, I found the directory at /home/dynamodblocal, so to answer the second question, here is how I currently handle persisting my local dynamodb tables:

docker run -it --rm -v %cd%:/home/dynamodblocal/data -p 8000:8000 amazon/dynamodb-local -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb -dbPath ./data

Read more comments on GitHub >

github_iconTop Results From Across the Web

DynamoDB local usage notes - AWS Documentation
To access DynamoDB running locally, use the --endpoint-url parameter. The following is an example of using the AWS CLI to list the tables...
Read more >
How to Set Up a Local DynamoDB in a Docker Container
In this tutorial, I am going to show you how to set up a local DynamoDB in a Docker container so that you...
Read more >
Running AWS DynamoDB Local with Docker-Compose
With the below command, you can pull dynamodb-local image from Docker Hub and run it locally on port 8000 in detached mode (...
Read more >
Run Amazon DynamoDB locally with Docker - dwmkerr.com
You can pass any of the documented commandline flags to DynamoDB. ... (the image is ephemeral by default, as per Dockerfile best practices)....
Read more >
What is the best way to pass AWS credentials to a Docker ...
First, specifically with AWS credentials on containers already running inside of the cloud, using IAM roles as Vor suggests is a really good...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found