> ## 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/DL3023

> `COPY --from` cannot reference its own `FROM` alias.

`COPY --from` cannot reference its own `FROM` alias.

| Property | Value |
| - | - |
| Severity | Error |
| Category | Correctness |
| Default | Enabled |

## Description

A `COPY --from` instruction must not reference the same stage it is running in. Trying to copy from the current stage results in an error because the
stage has not yet been finalized.

## Examples

### Problematic code

```dockerfile theme={null}
FROM debian:jesse as build
COPY --from=build some stuff ./
```

### Correct code

```dockerfile theme={null}
FROM debian:jesse as build
RUN stuff

FROM debian:jesse
COPY --from=build some stuff ./
```

## Reference

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


## Related topics

- [Hadolint rules](https://tally.wharflab.com/rules/hadolint/overview.md)
- [hadolint/DL3000](https://tally.wharflab.com/rules/hadolint/DL3000.md)
- [hadolint/DL3001](https://tally.wharflab.com/rules/hadolint/DL3001.md)
- [hadolint/DL3002](https://tally.wharflab.com/rules/hadolint/DL3002.md)
- [hadolint/DL3003](https://tally.wharflab.com/rules/hadolint/DL3003.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.