Reputation:
I am trying to link my api with my webapp but is doesn't seem to work. I have this error
[HPM] Error occurred while trying to proxy request /users/me from localhost:3000 to http://localhost:8080 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
When I try to sign in, it doesn't find the users.
Here is the contents of my docker-compose.yml file
version: '3'
services:
api:
build: ./web3-2019-api
ports:
- "8080:8080"
webapp:
build: ./web3-2019-webapp
ports:
- "3000:3000"
links:
- api
Upvotes: 0
Views: 537
Reputation: 5563
Try to connect via docker host api:8080
instead of localhost.
If you connect via localhost from webapp it expects 8080 to be running in webapp docker, but api is another docker and you should connect via api:8080
. Though both are running in same machine they are virtual machines and you should connect via respective docker name within docker network
Upvotes: 1