Skip to content

Commit 08a7b61

Browse files
committed
fix: healthcheck fails with BusyBox wget that lacks --spider flag
The healthcheck used wget --spider which is not supported by BusyBox wget that ships with nginx:alpine. This caused the healthcheck to fail with "wget: unrecognized option: spider" even when nginx was serving correctly. The container would be permanently marked unhealthy in: - Docker ps output - Docker Compose health status - Kubernetes liveness/readiness probes - GitHub Actions verification steps Changed to BusyBox-compatible syntax: - Before: wget --no-verbose --tries=1 --spider http://localhost/ - After: wget -q -O /dev/null http://localhost/ Both commands check if the server responds without downloading the body, but the new syntax works with BusyBox's limited wget implementation.
1 parent 7063f6c commit 08a7b61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ EXPOSE 80
3232

3333
# Health check
3434
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
35-
CMD wget --no-verbose --tries=1 --spider http://localhost/ || exit 1
35+
CMD wget -q -O /dev/null http://localhost/ || exit 1
3636

3737
# Start nginx
3838
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)