Skip to content

no-nested-onbuild

Dockerfilecorrectnessno fixdefault: errordockerfile/hadolint

Reports an ONBUILD whose instruction is ONBUILD, FROM or MAINTAINER.

Docker does not allow these as triggers: ONBUILD ONBUILD, ONBUILD FROM and ONBUILD MAINTAINER are rejected with an error when the file is built, so the Dockerfile cannot be used.

Reported
...
ONBUILD CMD echo hi
ONBUILD ONBUILD RUN x
ONBUILD MAINTAINER x
...
dockerfile:
lint:
rules:
no-nested-onbuild: error # off, warn, error (default)

Enabled by the presets: dockerfile/hadolint.

Suppress one line with sudsy-disable-next-line no-nested-onbuild in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
hadolint DL3043 full