From 21cc5e391bef9f4da11babb89769e5258c3db154 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Fri, 20 Feb 2026 11:09:36 -0600 Subject: [PATCH] store: Fix: Docker healthcheck - use node -e when container lacks wget/curl --- ...ode-e-when-container-lacks-wgetc-e9abb3.md | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 graph/fixes/fix-docker-healthcheck-use-node-e-when-container-lacks-wgetc-e9abb3.md diff --git a/graph/fixes/fix-docker-healthcheck-use-node-e-when-container-lacks-wgetc-e9abb3.md b/graph/fixes/fix-docker-healthcheck-use-node-e-when-container-lacks-wgetc-e9abb3.md new file mode 100644 index 00000000000..660efe207a3 --- /dev/null +++ b/graph/fixes/fix-docker-healthcheck-use-node-e-when-container-lacks-wgetc-e9abb3.md @@ -0,0 +1,37 @@ +--- +id: e9abb352-ae92-4714-9b07-5ee6568953d5 +type: fix +title: "Fix: Docker healthcheck - use node -e when container lacks wget/curl" +tags: [docker, healthcheck, troubleshooting, homelab, nodejs, fix] +importance: 0.6 +confidence: 0.8 +created: "2026-02-20T17:09:36.080059+00:00" +updated: "2026-02-20T17:09:36.080059+00:00" +--- + +# Fix: Docker Healthcheck Binary Missing in Container Image + +## Problem +A Docker container (Termix, `ghcr.io/lukegus/termix:latest`) was perpetually unhealthy. The `HEALTHCHECK` directive used `wget`, but the image had neither `wget` nor `curl` installed. + +## Diagnosis +When a container is stuck in `unhealthy` state, verify the binary used in the `HEALTHCHECK` actually exists in the image. + +## Fix +Replace the `wget`-based healthcheck with one using the app runtime (Node.js in this case): + +```yaml +healthcheck: + test: ["CMD", "node", "-e", "require('http').get('http://localhost:PORT', r => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"] + interval: 30s + timeout: 10s + retries: 3 +``` + +Replace `PORT` with the actual port the app listens on. + +## Important +- `docker compose restart` does NOT pick up compose file changes — must run `docker compose up -d` to recreate the container. + +## General Pattern +For Node.js apps without curl/wget, use the Node.js HTTP module directly in the healthcheck. Adapts to any language runtime available in the image (python3 -c, etc.).