user11475921
user11475921

Reputation: 31

Unable to execute HTTP request: Connect to localhost:8000 [localhost/127.0.0.1] failed: Connection refused (Connection refused)

I'm trying to install dynamodb locally for docker.

I've written the below code from here.

docker run -p 8000:8000 amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedD

Then I can reach localhost:8000/shell

In my client java, I set the endpoint

AmazonDynamoDB client = AmazonDynamoDBClientBuilder
    .standard()
    .withCredentials(new EnvironmentVariableCredentialsProvider())
    .withEndpointConfiguration(
        new AwsClientBuilder.EndpointConfiguration("http://localhost:8000/", "eu-central-1")
    ).build();

but when I run it, log the following error.

Can anyone help me? enter code here

Upvotes: 2

Views: 5122

Answers (1)

Shrikant Lahane
Shrikant Lahane

Reputation: 71

Replace your endpoint configuration from:

http://localhost:8000

To:

http://host.docker.internal:8000

Upvotes: 6

Related Questions