Skip to content

no-reserved-stage-name

Dockerfilesuspiciousno fixdefault: warndockerfile/hadolint

Reports a stage named scratch or context (FROM alpine AS scratch), compared without regard to case.

BuildKit reserves both names: scratch is the empty base image and context is the name of the build context. A stage that takes one of them collides with that meaning, so FROM scratch or a reference to context no longer clearly says what it uses.

Reported
...
FROM --platform=$BUILDPLATFORM alpine:3 AS scratch
FROM alpine:3@sha256:abc
...
WORKDIR /app
...
dockerfile:
lint:
rules:
no-reserved-stage-name: warn # off, warn (default), error

Enabled by the presets: dockerfile/hadolint.

Suppress one line with sudsy-disable-next-line no-reserved-stage-name 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 DL3063 full