| 1 |
## Output |
| 2 |
|
| 3 |
```text |
| 4 |
Duplicate stage name 'foo-base', stage names should be unique |
| 5 |
``` |
| 6 |
|
| 7 |
## Description |
| 8 |
|
| 9 |
Defining multiple stages with the same name results in an error because the |
| 10 |
builder is unable to uniquely resolve the stage name reference. |
| 11 |
|
| 12 |
## Examples |
| 13 |
|
| 14 |
❌ Bad: `builder` is declared as a stage name twice. |
| 15 |
|
| 16 |
```dockerfile |
| 17 |
FROM debian:latest AS builder |
| 18 |
RUN apt-get update; apt-get install -y curl |
| 19 |
|
| 20 |
FROM golang:latest AS builder |
| 21 |
``` |
| 22 |
|
| 23 |
✅ Good: stages have unique names. |
| 24 |
|
| 25 |
```dockerfile |
| 26 |
FROM debian:latest AS deb-builder |
| 27 |
RUN apt-get update; apt-get install -y curl |
| 28 |
|
| 29 |
FROM golang:latest AS go-builder |
| 30 |
``` |