15
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[小ネタ] DockerでlocalDynamoDB起動する時の注意点

Posted at

この記事に関して

Qiitaの3000文字Tips企画の投稿記事になります。

DynamoDBLocal起動時エラー

AWS公式ページ

のDockerタブにあるdocker-comose.ymlを使用する手順通りに実行すると以下のようなエラーが出るケースがあると思います(2021年6月7日時点)。遠くない未来に、コンテナ本体か手順のどちらかが修正されるとは思います。

Starting dynamodb-local ... done
Starting app-test       ... done
Attaching to dynamodb-local
dynamodb-local | Initializing DynamoDB Local with the following configuration:
dynamodb-local | Port:	8000
dynamodb-local | InMemory:	false
dynamodb-local | DbPath:	/home/dynamodblocal/data
dynamodb-local | SharedDb:	true
dynamodb-local | shouldDelayTransientStatuses:	false
dynamodb-local | CorsParams:	*
dynamodb-local | 
dynamodb-local | Jun 07, 2021 1:25:32 AM com.almworks.sqlite4java.Internal log
dynamodb-local | WARNING: [sqlite] cannot open DB[1]: com.almworks.sqlite4java.SQLiteException: [14] unable to open database file
dynamodb-local | Jun 07, 2021 1:25:32 AM com.almworks.sqlite4java.Internal log
dynamodb-local | SEVERE: [sqlite] SQLiteQueue[shared-local-instance.db]: error running job queue
dynamodb-local | com.almworks.sqlite4java.SQLiteException: [14] unable to open database file
dynamodb-local | 	at com.almworks.sqlite4java.SQLiteConnection.open0(SQLiteConnection.java:1480)
dynamodb-local | 	at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:282)
dynamodb-local | 	at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:293)
dynamodb-local | 	at com.almworks.sqlite4java.SQLiteQueue.openConnection(SQLiteQueue.java:464)
dynamodb-local | 	at com.almworks.sqlite4java.SQLiteQueue.queueFunction(SQLiteQueue.java:641)
dynamodb-local | 	at com.almworks.sqlite4java.SQLiteQueue.runQueue(SQLiteQueue.java:623)
dynamodb-local | 	at com.almworks.sqlite4java.SQLiteQueue.access$000(SQLiteQueue.java:77)
dynamodb-local | 	at com.almworks.sqlite4java.SQLiteQueue$1.run(SQLiteQueue.java:205)
dynamodb-local | 	at java.lang.Thread.run(Thread.java:748)

対応方法

コンテナ内部では、dynamodblocalというユーザーで処理されているので、そのフォルダに書き込み出来たりする権限が必要です。
標準のdocker-compose.ymlのままいくなら、docker-comose.ymlがあるフォルダで、以下のコマンドで権限振りましょう。起動前ならフォルダ作成もしておきましょう。

mkdir -p ./docker/dynamodb # docker-compose起動前でフォルダ出来てない時に実行
sudo chmod 777 ./docker/dynamodb # 上記状況で、通常ユーザーでフォルダ作ったならsudoはいらない
15
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?