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:
-pis for defining the port to expose, so your app can contact dynamodb-local on port 8000--nameis for giving a readable name to the imageeverything after
amazon/dynamodb-localis the overriding part, the predefined entrypoint isJAVA, so we just need to add the-jarswitch, specify the file name to run, and omit that evil-inMemoryswitchIt’s an option to add a flag
-sharedDbto 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