DEV Community

xiaoran
xiaoran

Posted on

DynamoDB local version running (DynamoDB local)

Install Docker and Docker Compose environments

apt install docker

apt install docker compose
Enter fullscreen mode Exit fullscreen mode

create profile

vi docker-compose.yml
Enter fullscreen mode Exit fullscreen mode

The file content is as follows

version: '3.8'
services:
  dynamodb-local:
    command: "-jar DynamoDBLocal.jar -sharedDb -dbPath ./data"
    image: "amazon/dynamodb-local:latest"
    container_name: dynamodb-local
    ports:
      - "8000:8000"
    volumes:
      - "./docker/dynamodb:/home/dynamodblocal/data"
    working_dir: /home/dynamodblocal
Enter fullscreen mode Exit fullscreen mode

Start Service

docker-compose up -d
Enter fullscreen mode Exit fullscreen mode

If an error is reported: prompt for version mismatch

modify

Version: '3.8'
Enter fullscreen mode Exit fullscreen mode

by


Version: '3.3'
Enter fullscreen mode Exit fullscreen mode

Start again to view the logs:

docker logs -f dynamodb-local
Enter fullscreen mode Exit fullscreen mode

If an error is reported:

SEVERE: [sqlite] SQLiteQueue [shared local instance. db]: error running job queue

Com. almworks. sqlite4java. SQLiteException: [14] cannot open database file

At com. almworks. sqlite4java. SQLiteConnection. open0 (SQLiteConnection. java: 1480)

At com. almworks. sqlite4java. SQLiteConnection. open (SQLiteConnection. java: 282)

At com. almworks. sqlite4java. SQLiteConnection. open (SQLiteConnection. java: 293)

At com. almworks. sqlite4java. SQLiteQueue. openConnection (SQLiteQueue. java: 464)

At com. almworks. sqlite4java. SQLiteQueue. queueFunction (SQLiteQueue. java: 641)

At com. almworks. sqlite4java. SQLiteQueue. runQueue (SQLiteQueue. java: 623)

At com. almworks. sqlite4java. SQLiteQueue. access $000 (SQLiteQueue. java: 77)

At com. almworks. sqlite4java. SQLiteQueue $1. run (SQLiteQueue. java: 205)

At java. base/java. lang. Thread. run (Thread. java: 829)



Enter fullscreen mode Exit fullscreen mode

Add at the bottom of the configuration file

user: root
Enter fullscreen mode Exit fullscreen mode

Final configuration:


version: '3.3'
services:
  dynamodb-local:
    command: "-jar DynamoDBLocal.jar -sharedDb -dbPath ./data"
    image: "amazon/dynamodb-local:latest"
    container_name: dynamodb-local
    ports:
      - "8000:8000"
    volumes:
      - "./docker/dynamodb:/home/dynamodblocal/data"
    working_dir: /home/dynamodblocal
    user: root
Enter fullscreen mode Exit fullscreen mode

Top comments (0)