0

I am using a symfony app and connecting to a local dynamodb instance in a docker container.

I keep getting AWS HTTP error: cURL error 7: Failed to connect to db port 8889: Connection refused error.

My docker-compose file is simply:

version: '3'
services:
  web:
    depends_on:
        - db
    build: .
    ports:
        - "8000:8000"
  db:
    image: "amazon/dynamodb-local"
    ports:
        - "8889:8889"

Honestly, I always get confused by the port mapping, but I don't think that should matter here. I'm trying to connect to http://db:8889. To make things simpler, I executed the following inside my web container:

# curl http://db:8889
curl: (7) Failed to connect to db port 8889: Connection refused

I'm kinda stumped, and I think this is such a simple thing most of the docs skim right over it. (or maybe I do)

1
  • Can you try omitting the http:// part in the connection url? Commented Aug 29, 2018 at 21:18

1 Answer 1

1

The image documentation suggests the DynamoDB server runs on port 8000, so you should access it as http://db:8000. You don't have to publish it on port 8000 or on any port at all, but you need to use the container-side port number to reach it from other containers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.