Skip to main content

DL3012: Multiple HEALTHCHECK instructions

Error Reliability

Why This Matters

Only the last HEALTHCHECK instruction takes effect. Multiple HEALTHCHECK instructions are always a mistake because the earlier ones are silently overridden. This causes confusion when health checks do not behave as expected because the intended check was overridden by a later one. Keep a single HEALTHCHECK per Dockerfile.

How to Fix

Remove duplicate HEALTHCHECK instructions, keep only the final one

Before (incorrect)

HEALTHCHECK CMD curl http://localhost/
HEALTHCHECK CMD curl http://localhost/health

After (correct)

HEALTHCHECK CMD curl http://localhost/health

Rule Details

Rule Code
DL3012
Severity
Error
Category
Reliability

Related Rules