copy-from-own-stage
What it does
Section titled “What it does”Reports a COPY --from that names its own stage. That is COPY --from=build in the stage that FROM alpine AS build starts. Names are compared without regard to case.
Why it matters
Section titled “Why it matters”A stage cannot copy from itself: its content does not exist yet while it is built, and BuildKit stops with a circular dependency error. The source is usually an earlier stage, or the build context (then drop --from).
Example
Section titled “Example”...FROM alpine:3 AS lastCOPY --from=LAST /a /bUSER appCMD ["a"]...Configuration
Section titled “Configuration”dockerfile: lint: rules: copy-from-own-stage: error # off, warn, error (default)Enabled by the presets: dockerfile/hadolint.
Suppress one line with sudsy-disable-next-line copy-from-own-stage 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 | DL3023 |
full |