fix: healthcheck — replace GNU-wget -I flag with --spider

BusyBox wget in alpine doesn't support -I flag, healthcheck was
failing with 'unrecognized option' and Docker reported container
as unhealthy despite nginx working correctly.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dmitry Gusev
2026-05-10 15:47:53 +03:00
parent 98cf294a0c
commit 233af27773
2 changed files with 2 additions and 2 deletions

View File

@@ -6,4 +6,4 @@ COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 8080 EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget -qO- http://127.0.0.1:8080/ -I 2>&1 | grep -q "301 Moved" || exit 1 CMD wget -q --spider http://127.0.0.1:8080/ || exit 1

View File

@@ -9,7 +9,7 @@ services:
ports: ports:
- "127.0.0.1:4083:8080" - "127.0.0.1:4083:8080"
healthcheck: healthcheck:
test: ["CMD", "wget", "-qO-", "-I", "http://127.0.0.1:8080/"] test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:8080/"]
interval: 30s interval: 30s
timeout: 5s timeout: 5s
retries: 3 retries: 3