moby / moby/buildkit

Cannot "FROM" a previous stage whose name contains uppercase letters

Open
#2,003 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area/dockerfile area/feature-parity
Dominant language
Go
Stars
10.3k
Forks
1.5k
Avg merge
1d 21h
Merged PRs (30d)
50

Description

When performing multi-stage builds with BuildKit, I find it impossible to "FROM" a previous stage whose name contains uppercase letters.

A simple Dockerfile as following:

FROM alpine:3 AS TEST

FROM TEST

gives the error repository name must be lowercase:

Dockerfile:3
--------------------
   1 |     FROM alpine:3 AS TEST
   2 |
   3 | >>> FROM TEST
   4 |
--------------------
error: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to parse stage name "TEST": invalid reference format: repository name must be lowercase

However, Docker just accepts it when using docker build:

Sending build context to Docker daemon  160.3kB
Step 1/2 : FROM alpine:3 AS TEST
 ---> 7731472c3f2a
Step 2/2 : FROM TEST
 ---> 7731472c3f2a
Successfully built 7731472c3f2a

I hope BuildKit can recognize the name is of a previous stage, not a repository.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the Dockerfile shown and the BuildKit Dockerfile frontend, then trace how stage names are parsed when resolving the second FROM. Done means an uppercase previous-stage name resolves like the lowercase case and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
dockerfile, go
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.