Skip to content

buildkit/DuplicateStageName

Stage names in a multi-stage build should be unique.

Property Value
Severity Error
Category Correctness
Default Enabled

Description

Defining multiple stages with the same name results in an error because the builder is unable to uniquely resolve the stage name reference.

Examples

Bad:

FROM debian:latest AS builder
RUN apt-get update; apt-get install -y curl

FROM golang:latest AS builder

Good:

FROM debian:latest AS deb-builder
RUN apt-get update; apt-get install -y curl

FROM golang:latest AS go-builder

Supersedes

Reference