copy-many-needs-directory
What it does
Section titled “What it does”Reports a COPY with several sources whose destination does not end with / (COPY a b /app). The JSON form, a single source and a heredoc (<<) are not checked.
Why it matters
Section titled “Why it matters”With several sources the destination must be a directory, and Docker takes a destination without a trailing slash for a file name. The build stops with an error that the destination of a copy of several sources must end with /.
Example
Section titled “Example”...COPY a b /destCOPY a b /dest/COPY a /dest...Configuration
Section titled “Configuration”dockerfile: lint: rules: copy-many-needs-directory: error # off, warn, error (default)Enabled by the presets: dockerfile/hadolint.
Suppress one line with sudsy-disable-next-line copy-many-needs-directory in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| hadolint | DL3021 |
partial | The shell form only; the JSON form is not checked. |