I built a Spring Boot REST API that queries DynamoDB, and I would like to configure one or two Docker containers that run as microservices: one that runs DynamoDB locally and another that runs the REST API. I have a container configured for the Spring Boot REST API, but when I make calls to the API, it cannot query the local DynamoDB even though DynamoDB is running on localhost:8000. The error I get is:
Unable to execute HTTP request: Connect to localhost:8000 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Despite getting that message, I can access DynamoDB via localhost using my browser. It's as if the Docker container will not allow the API to access localhost:8000 even though the API container is running at localhost:8080.
How should I configure my container(s) so that each runs as a separate microservice? Has anyone seen a similar issue before?