Skip to main content

DL3057: HEALTHCHECK instruction is missing

Info Maintainability

Why This Matters

Without a HEALTHCHECK, Docker and orchestrators like Kubernetes have no way to verify that the container is actually functioning correctly. A container can appear "running" while the application inside has crashed, and it will keep serving errors until someone notices and intervenes manually. Adding HEALTHCHECK enables automatic detection and restart of unhealthy containers.

How to Fix

Add a HEALTHCHECK instruction to verify the app is running

Before (incorrect)

CMD ["node", "server.js"]

After (correct)

HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
  CMD curl -f http://localhost:8080/health || exit 1
CMD ["node", "server.js"]

Rule Details

Rule Code
DL3057
Severity
Info
Category
Maintainability

Related Rules