I have trying to build a Docker image using a Dockerfile available locally.
docker build -t newimage .
I have used this command multiple times earlier too, but somehow its not working currently and i am stuck finding the reason for it.
I will be really helpful if someone can help me with a possible solution or a possible area to look for an issue.
i already had a look over other posts that could have been related for example : Docker build tag repository name
Okay! I found out the reason for issue.
DOCKER BUILD PROCESS
When we build a docker image, while creating a image several other intermediate images are generated in the process. We never see them in docker images
because with the generation of next intermediate image the earlier image is removed.And in the end we have only one which is the final image.
The tag we provide using -t
or --tag
is for the final build, and obviously no intermediate container is tagged with the same.
ISSUE EXPLANATION
When we try to build a docker image with Dockerfile sometimes the process is not successfully completed with a similar message like Successfully built image with IMAGEID
So it is so obvious that the build which has failed will not be listed in docker images
Now, the image with tag <none>
is some other image (intermediate). This creates a confusion that the image exists but without a tag, but the image is actually not what the final build should be, hence not tagged.