Counldn't connect to Nakama server error in docker

Hello everyone, I’m trying to run Nakama and nodejs using the Docker container. The Nakama server return response “error” when I authenticated with the device.I checked in the Docker log it says “Counldn’t connect to Nakama server; message: FetchError: request to http://127.0.0.1:7350/v2/account/authenticate/device? failed, reason: connect ECONNREFUSED 127.0.0.1:7350”. It works well when I try it on the browser.

Thank you.

When referencing 127.0.0.1 or localhost in a running container that resolves back to that container, not to the host environment. The solution is to connect to nakama:7350 instead - this references the service name in the docker-compose file and will resolve correctly to the Nakama container.

@zyro Thank you

1 Like