From 2cb29c188272a9c58f768f7dfa971bfa7de6224f Mon Sep 17 00:00:00 2001 From: aniebietafia Date: Sat, 23 May 2026 13:12:42 +0100 Subject: [PATCH] fix(healthcheck): force IPv4 127.0.0.1 for API healthchecks Change healthcheck targets from `localhost` to `127.0.0.1` in Dockerfile and docker-compose.prod.yml to prevent curl connection failures when localhost resolves to IPv6 loopback (::1). Signed-off-by: aniebietafia --- Dockerfile | 2 +- docker-compose.prod.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6842fd7..454527a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,7 +49,7 @@ USER appuser EXPOSE 8000 HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ - CMD curl -f http://localhost:8000/health || exit 1 + CMD curl -f http://127.0.0.1:8000/health || exit 1 # Run using the python interpreter inside the virtual environment ENV PATH="/app/.venv/bin:$PATH" diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 259060c..fe4dc85 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -65,7 +65,7 @@ services: ports: - "8000:8000" healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8000/health"] + test: ["CMD", "curl", "-f", "http://127.0.0.1:8000/health"] interval: 10s timeout: 5s retries: 5