带有--tag的Docker build命令无法标记图像 [英] Docker build command with --tag unable to tag images

查看:176
本文介绍了带有--tag的Docker build命令无法标记图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用本地可用的Dockerfile构建Docker映像.

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.

我已经查看了可能与之相关的其他帖子,例如: Docker构建标签存储库名称

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构建过程

当我们构建docker映像时,在创建映像时,在此过程中还会生成其他一些中间映像.我们永远不会在docker images中看到它们,因为随着生成下一个中间图像,较早的图像被删除了.最后,只有一个是最终图像.

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.

我们使用-t--tag提供的标签用于最终构建,显然没有中间容器使用相同的标签.

The tag we provide using -t or --tag is for the final build, and obviously no intermediate container is tagged with the same.

问题说明

当我们尝试使用Dockerfile构建Docker映像时,有时该过程无法成功完成,并显示类似Successfully built image with IMAGEID

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

因此很明显,失败的版本将不会在docker images

So it is so obvious that the build which has failed will not be listed in docker images

现在,标签为<none>的图像是其他图像(中间).这就造成了一个困惑,即该图像存在但没有标签,但是该图像实际上不是最终构建的图像,因此没有标签.

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.

这篇关于带有--tag的Docker build命令无法标记图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆