single-cmd
What it does
Section titled “What it does”Reports each CMD after the first one in the same stage. A CMD after ONBUILD is not counted, and a new FROM starts the count again.
Why it matters
Section titled “Why it matters”A container has one default command. When a stage lists several CMD instructions only the last one takes effect, and the earlier ones do nothing. They look like configuration that runs, so a reader edits the wrong line or believes a command runs that never does.
Delete all but the one you mean.
Example
Section titled “Example”...EXPOSE 80/tcp 443...CMD ["node", "server.js"]...ONBUILD CMD echo hi...Configuration
Section titled “Configuration”dockerfile: lint: rules: single-cmd: warn # off, warn (default), errorEnabled by the presets: dockerfile/hadolint.
Suppress one line with sudsy-disable-next-line single-cmd in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| hadolint | DL4003 |
full |