Docker Community Forums

Share and learn in the Docker community.

Set name for the stage image in multistage build

Hi there!

There is a Dockerfile with multistage build. As example.

1 │ FROM alpine AS first
2 │
3 │ RUN touch 1.txt
4 │
5 │ FROM alpine
6 │
7 │ CMD echo “test”

If I run it, I will get two images.

docker build -t test_image -f Dockerfile .

docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              06b13936c904        5 seconds ago       5.57MB
test_image          latest              1c7f348eaa8f        5 seconds ago       5.57MB

Is there any way to set a name for the none image (first in Dockerfile)?
I’d like to see the name in order to separate it from other none images that can be created by other builds.