Skip to content

hadolint/DL3021

COPY with more than 2 arguments requires the last argument to end with /.

Property Value
Severity Error
Category Correctness
Default Enabled

Description

If multiple source resources are specified in a COPY instruction, then the destination must be a directory and it must end with a slash /. Omitting the trailing slash causes ambiguity and may lead to build errors or unexpected behavior.

Examples

Problematic code

FROM node:carbon
COPY package.json yarn.lock my_app

Correct code

FROM node:carbon
COPY package.json yarn.lock my_app/

Reference