> ## Documentation Index
> Fetch the complete documentation index at: https://tally.wharflab.com/llms.txt
> Use this file to discover all available pages before exploring further.

# hadolint/DL3021

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

`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

```dockerfile theme={null}
FROM node:carbon
COPY package.json yarn.lock my_app
```

### Correct code

```dockerfile theme={null}
FROM node:carbon
COPY package.json yarn.lock my_app/
```

## Reference

* [hadolint/DL3021](https://github.com/hadolint/hadolint/wiki/DL3021)
