According to docs there are 2 flags that affects run of dynamodb-local
-inMemory
-> makes all data to persist in RAM only, when service is terminated - all data gets deleted
-sharedDB
-> makes all logins to be written to the same shared file
no switces -> each credentials login persists data in different file - this is the default behavior
However, if you look in docker.hub you'll see that the default behavior when running dynamodb-local in docker is with the -inMemory
flag. but I don't want it, I want the real default behavior.
How can I override it?
Well, it was very hard to find it, but it's a very simple solution.
According to this great post, we can easily override the
[CMD]
part of the docker pulled image.We just need to add the args after docker run. This is the command that I used:
-p
is for defining the port to expose, so your app can contact dynamodb-local on port 8000--name
is for giving a readable name to the imageeverything after
amazon/dynamodb-local
is the overriding part, the predefined entrypoint isJAVA
, so we just need to add the-jar
switch, specify the file name to run, and omit that evil-inMemory
switchIt’s an option to add a flag
-sharedDb
to make all credentials to connect to the same DB, otherwise - the default is different file for each set of credentials (including region!)Good luck all! and Happy coding