Closed jcranfordupgrade closed 9 months ago
The versions I used:
% uname -a
Darwin J5R6K724LM-jcranford 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64
% docker-compose --version
Docker Compose version v2.18.1
% docker --version
Docker version 20.10.23, build 715524332f
Steps to reproduce the problem:
docker-compose up node -d
localhost
: curl http://localhost:3000
localhost
: curl http://localhost:8000
http://localhost:3000/
=> Displays this error within the page
Unable to fetch link_token: please make sure your backend server is running and that your .env file has been configured with your PLAID_CLIENT_ID and PLAID_SECRET.
Steps to diagnose the problem:
docker exec -it start-frontend-1 sh
apk add curl
apk add net-tools
curl http://localhost:3000
curl http://localhost:8000
curl: (7) Failed to connect to localhost port 8000 after 0 ms: Couldn't connect to server
curl http://start-node-1:8000
=> It works!curl http://host.docker.internal:8000
=> It works!Steps to apply the workaround:
frontend
service, set environment variable REACT_APP_API_HOST=http://start-node-1:8000
docker-compose restart
http://localhost:3000/
=> It works!
Launch Link
Thanks for the report! I believe the issue here is the command used to start the Quickstart. When I tried starting the quickstart as you describe, using docker-compose up node -d
, the command failed like you describe. When I tried starting the Quickstart according to the directions in the README, which specify using make up language=node
(or whatever other language you want to use) it succeeded.
I tried running
docker-compose up node -d
on Mac. When I open http://localhost:3000 on my host, I get an error in the UI page similar to #405.However, it seems like the root cause and workaround might be different, and may require a fix in docker-compose.yml.
I did some googling, and it seems newer versions of Docker frown on using
localhost
for connections between containers. Docker seems to want people to use something else:start-node-1
) to point to a specific container.host.docker.internal
to point to the host's localhost (i.e. not the container's localhost).extra_hosts
?To workaround the issue, I edited docker-compose.yml to set the
REACT_APP_API_HOST
environment variable in frontend service. After restarting docker-compose, the Frontend UI worked.Both of these workarounds worked for me:
REACT_APP_API_HOST=http://host.docker.internal:8000
REACT_APP_API_HOST=http://start-node-1:8000
The second option is specific to using the node container. The first option might be more generic to work with other implementations of the API container (e.g. Java, Go, etc).