Given this small example of a multistage build
FROM node:10 AS ui-build
WORKDIR /usr/src/app
FROM node:10 AS server-build
WORKDIR /root/
EXPOSE 3070
ENTRYPOINT ["node"]
CMD ["index.js"]
why does this result in 3 images on my local file system?
"<none>";"<none>";"58d63982fbef";"2020-04-15 17:53:14";"912MB"
"node";"10";"bd83fcefc19d";"2020-04-14 01:32:21";"912MB"
"test";"latest";"3913dd4d03b6";"2020-04-15 17:53:15";"912MB"
I expected two images, the base image and the server-build image. I used the standard docker build command, i.e.
docker build -t test .
so which of the parts of the image is none and which is test?
I am confused
Each block in the Dockerfile starting with a
FROM
line creates a new image. If you use adocker build -t
option, only the last stage gets tagged with the name you specify; the remaining blocks will appear as<none>
in places likedocker images
output.You will occasionally see Dockerfiles where a base image is reused in later build stages, and there it will not show up at all in
docker images
output.