afreeman
afreeman

Reputation: 21

ReadTimeout trying to connect to dynamodb-local in CodeBuild

I am trying to execute pytests that use dynamodb-local docker container in CodeBuild.
I figured out how to run docker in CodeBuild by setting Privileged mode to True.
The docker container gets built successfully and is running in the CodeBuild instance.
I keep getting a ReadTimeout error when I try to connect to dynamodb in the container.

I can curl http://localhost:8000 and get the expected MissingAuthToken response.
But when I try to aws dynamodb list-tables --endpoint-url http://localhost:8000/, I get a ReadTimeout error.
And when I try to run my tests and create a table in the dynamodb-local container, I get the same ReadTimeout error.
I can run all my unit tests that don't use the container but I can't get past this timeout error.

Upvotes: 2

Views: 319

Answers (2)

afreeman
afreeman

Reputation: 21

Instead of running dynamodb-local in docker I was able to run it like this.

filename=dynamodb_local_latest.tar.gz
# download the latest version of DynamoDB Local
curl -O https://d1ni2b6xgvw0s0.cloudfront.net/v2.x/$filename
tar -xvzf $filename
rm $filename
# run DynamoDB Local as a background process
java -jar DynamoDBLocal.jar &

Upvotes: 0

yoshimu
yoshimu

Reputation: 1

Please check the logs
docker container logs <CONTAINER-Id>

It may be a problem with the permission settings of the directory you specified as the volume source.

If the volume setting in docker-compose.yml is as follows,

volumes: - "./docker/dynamodb:/home/dynamodblocal/data"

please try setting the permissions on the host side.
chmod 777 ./docker/dynamodb

Upvotes: 0

Related Questions