Nopileos
Nopileos•6mo ago

Hi and good morning.

Hi and good morning. I have a strange issue. I want to add a healthcheck to my docker-compose setup. The docs say, that there is an /api/public/health endpoint that I can request. Thing is, that works when I check the endpoint from the outside (i.e. my host on which the docker container runs). But as soon as I try to request that uri from within the container (where docker compose runs the healthcheck), I get an error. I connect to /bin/sh in the container. default user is nextjs:
/app $ wget --no-verbose --tries=1 --spider http://localhost:3000/api/public/health
Connecting to localhost:3000 ([::1]:3000)
wget: can't connect to remote host: Connection refused
/app $
/app $ wget --no-verbose --tries=1 --spider http://localhost:3000/api/public/health
Connecting to localhost:3000 ([::1]:3000)
wget: can't connect to remote host: Connection refused
/app $
So, why can I reques that url from outside of the container, but not from within?
2 Replies
Nopileos
Nopileos•6mo ago
It's not about authentication. I also send the request from the outside without any authentication info. Also, using 127.0.0.1 or 0.0.0.0 instread of localhost doesn't change anything What the... when I use the container name it works 🤯
Marc
Marc•6mo ago
Have you tried setting the HOSTNAME env? This sometimes resolves docker networking issues depending on your environment. https://langfuse.com/docs/deployment/self-host#troubleshooting
Self-Hosting Guide - Langfuse
Self-host Langfuse in your infrastructure using Docker.