From af1a6c8165552c514c038594dc7037986d7b3ecd Mon Sep 17 00:00:00 2001 From: jknapp Date: Fri, 12 Jun 2026 12:16:25 -0700 Subject: [PATCH] fix(compose): app healthcheck uses 127.0.0.1 not localhost Inside the app container localhost resolves to ::1 (IPv6) first, but the Next.js standalone server listens only on 0.0.0.0 (IPv4). The healthcheck probed http://localhost:3000/api/health and got Connection refused on ::1, so the container reported unhealthy for weeks despite serving 200 on both / and /api/health. Switch the probe to 127.0.0.1 to match the bound iface. The db and embedder healthchecks already avoid localhost. Co-Authored-By: Claude Opus 4.8 (1M context) --- docker-compose.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index cfcb437..0b4307b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -129,7 +129,11 @@ services: # but you can bind to 127.0.0.1 only by setting APP_BIND=127.0.0.1. - "${APP_BIND:-0.0.0.0}:${APP_PORT:-3000}:3000" healthcheck: - test: ["CMD-SHELL", "wget -q -O /dev/null http://localhost:3000/api/health || exit 1"] + # Use 127.0.0.1, not localhost: inside the container localhost resolves + # to ::1 (IPv6) first, but the Next.js standalone server listens only on + # 0.0.0.0 (IPv4), so a localhost probe gets "Connection refused" and the + # container is reported unhealthy even though the app serves fine. + test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1:3000/api/health || exit 1"] interval: 15s timeout: 5s retries: 5