no-copy-whole-stage
What it does
Section titled “What it does”Reports a COPY --from=stage / /, which copies the whole file system of a stage to /. A copy of / into a folder (/app/) or of a folder is not reported.
Why it matters
Section titled “Why it matters”It copies everything of the build stage: compilers, package caches, sources, and the stage’s own /etc and /usr over the ones of the final image. The image becomes as large as the build stage, which defeats the purpose of a multi-stage build, and files of the base image are overwritten.
Copy only what the final image needs: COPY --from=build /out/app /usr/local/bin/.
Example
Section titled “Example”...COPY --from=0 / /...COPY a b /dest/COPY a /dest...Configuration
Section titled “Configuration”dockerfile: lint: rules: no-copy-whole-stage: warn # off (default), warn, errorEnabled by the presets: dockerfile/hadolint.
Suppress one line with sudsy-disable-next-line no-copy-whole-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 | DL3067 |
full |