When you use DynamoDB and you have good codebase test coverage, chances are that you tend to use a lot local DynamoDB.
Docker comes really in handy in order to distribute a pre-configured local dynamo db among your dev teams or your Continuous integration server.
I will use a Centos image.
We will need Java.
I prefer the oracle jdk therefore I have to accept the license and download locally the java rpm.
In case you want open jdk you can just install it through yum
So we create the Dockerfile.
I will use the default port which is 8000 so I will expose port 8000.
jdk-8u91-linux-x64.rpm is the oracle java I downloaded previously.
FROM centos ADD jdk-8u91-linux-x64.rpm / RUN rpm -Uvh jdk-8u91-linux-x64.rpm RUN rm /jdk-8u91-linux-x64.rpm RUN mkdir /opt/DynamoDB RUN curl -O -L http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz RUN mv dynamodb_local_latest.tar.gz /opt/DynamoDB/ RUN cd /opt/DynamoDB && tar xvf dynamodb_local_latest.tar.gz && rm dynamodb_local_latest.tar.gz EXPOSE 8000 ENTRYPOINT ["java","-Djava.library.path=/opt/DynamoDB/DynamoDBLocal_lib","-jar","/opt/DynamoDB/DynamoDBLocal.jar","-sharedDb"]
Then we build our image
docker build -t dynamodb .
No we run the container on the background
docker run -p 8000:8000 -d dynamodb