From f0ee1289e1aaa8cc1b2d54663f48bbe8aa925d18 Mon Sep 17 00:00:00 2001 From: dlawler489 <104159223@student.swin.edu.au> Date: Sat, 20 Jun 2026 08:24:14 +1000 Subject: [PATCH] Make nginx healthcheck deterministic (was flapping to unhealthy) BusyBox wget --spider on nginx:alpine flaps and 'localhost' may resolve to IPv6 first, marking the container unhealthy while it serves fine. Use an explicit 127.0.0.1 fetch-and-discard with more retries. Co-Authored-By: Claude Opus 4.8 --- docker-compose.deploy.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker-compose.deploy.yml b/docker-compose.deploy.yml index 51cf559..8b61459 100644 --- a/docker-compose.deploy.yml +++ b/docker-compose.deploy.yml @@ -18,12 +18,15 @@ services: networks: - etsy-network - traefik_default + # Use an explicit IPv4 fetch-and-discard; BusyBox wget --spider flaps on + # nginx:alpine and 'localhost' can resolve to IPv6 first, causing false + # "unhealthy" even though nginx is serving fine. healthcheck: - test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost/"] + test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1/ || exit 1"] interval: 30s timeout: 10s - retries: 3 - start_period: 10s + retries: 5 + start_period: 20s # Etsy Finance Tracker API Server (from GitHub Container Registry) etsy-tracker: