| Property | Value |
|---|---|
| Severity | Error |
| Category | Correctness |
| Default | Enabled |
Description
DetectsCOPY --from=<stage> instructions where the source stage is FROM scratch and contains
no ADD, COPY, or RUN instructions. Since scratch stages start with an empty filesystem,
any COPY --from referencing such a stage is guaranteed to fail at build time.
Common causes:
- A stage was renamed or deleted during a refactor, leaving an empty placeholder
- An AI patch accidentally removed the instructions that populated the stage
- A
COPY/RUNwas moved to a different stage but theCOPY --fromreference wasn’t updated
ENV, LABEL, EXPOSE, WORKDIR, and USER do not produce filesystem
content and are not considered file-producing for this check.
Examples
Bad
Good
Related rules
tally/shell-run-in-scratch— a scratch stage with only a shell-formRUNis not considered empty by this rule (anyRUNcounts as file-producing). Theshell-run-in-scratchrule warns about the failingRUNinstead. If the user removes thatRUN, this rule will then fire on downstreamCOPY --fromreferences.