Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

545
Views
Change amazon/dynamodb-local Port

How can I change the port dynamodb starts on through the Amazon Docker image?

According to this answer, the -port option can be used when executing the dynamodb java file.

However, when running the docker image with this command: docker run -p 8000:8000 amazon/dynamodb-local I do not have the option of specifying the port dynamodb listens to, just the port connected between my host and the container.

Would I have to make my own Dockerfile, specifying the OS and installing dynamodb and whatnot, so I can run the java command and specify my port?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

You don't need to rebuild the image. Doing

docker inspect amazon/dynamodb-local

shows that the Entrypoint is set as

  "Entrypoint": [
   "java"
 ],

So running the below command gives an error:

 $ docker run -p 8001:8001 amazon/dynamodb-local -port 8001
 Unrecognized option: -port
 Error: Could not create the Java Virtual Machine.
 Error: A fatal exception has occurred. Program will exit.

because we are trying to pass -port argument to java but we need to pass it to DynamoDBLocal.jar.

Once we know that, we can add the jar to the docker run and the following works:

$ docker run -p 8001:8001 amazon/dynamodb-local -jar DynamoDBLocal.jar -port 8001

Initializing DynamoDB Local with the following configuration:
Port:   8001
InMemory:       false
DbPath: null
SharedDb:       false
shouldDelayTransientStatuses:   false
CorsParams:     *

I would raise it as a bug but https://hub.docker.com/r/amazon/dynamodb-local/ doesn't mention a public github repo to raise the issue.

over 4 years ago · Santiago Trujillo Report

0

I tried the official image to override entry point but there was some unknown error, But you can good to go with this approach. Just create a New Docker image from amazon/dynamodb-local as a base image. Build.

docker build -t mydb .

and run it

docker run -it --rm -p 8001:8001 mydb

Below is the Dockerfile

FROM amazon/dynamodb-local
WORKDIR /home/dynamodblocal
ENTRYPOINT ["java", "-jar", "DynamoDBLocal.jar", "-port", "8003"]

As you will see the port.

enter image description here

over 4 years ago · Santiago Trujillo Report

0

For some reason docker-compose does not map ports to the host for dynamodb. The next configuration will not work for the dynamodb-local image:

    ports:
    - "9000:8000"

The workaround is to put the port directly to the command, -port 9000 is the same as ports: - "9000:9000" in docker-compose.

version: "3.8"

services:
  service-dynamodb:
    image: amazon/dynamodb-local
    image: "amazon/dynamodb-local:latest"
    working_dir: /home/dynamodblocal
    # -port {number} is the same as 
    # ports: - {number}:{number} in Docker
    command: "-jar DynamoDBLocal.jar -port 9000 -sharedDb -optimizeDbBeforeStartup -dbPath ./data"
    volumes:
      - ./data:/home/dynamodblocal/data
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!