| Property | Value |
|---|---|
| Severity | Warning |
| Category | Best Practice |
| Default | Enabled |
| Auto-fix | Yes (--fix) |
Description
If you have multipleCMD, HEALTHCHECK, or ENTRYPOINT instructions in your
Dockerfile, only the last occurrence is used. An image can only ever have one
CMD, one HEALTHCHECK, and one ENTRYPOINT.
Examples
Bad:CMD and a separate CMD for HEALTHCHECK:
Auto-fix
The fix comments out duplicateCMD/ENTRYPOINT/HEALTHCHECK instructions,
keeping only the last one in each stage.
Supersedes
- hadolint/DL3012 (multiple
HEALTHCHECK) - hadolint/DL4003 (multiple
CMD) - hadolint/DL4004 (multiple
ENTRYPOINT)