Skip to content

hadolint/DL4003

Multiple CMD instructions found.

Superseded by buildkit/MultipleInstructionsDisallowed, which covers duplicate CMD, ENTRYPOINT, and HEALTHCHECK instructions with auto-fix support.

Description

If more than one CMD instruction is listed, only the last one takes effect.

Examples

Problematic code

FROM alpine
CMD echo "first"
CMD echo "second"

Correct code

FROM alpine
CMD echo "second"

Reference