问题描述
这是在我运行 docker build
之前显示的 docker图像
This is what docker images
shows before I run docker build
.
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
myapp latest a38da0bd9e0b 6 seconds ago 523.8 MB
golang onbuild b4997c557048 10 days ago 517.2 MB
在对 myapp进行一些更改后
源代码,我运行 docker build -t myapp。
,最后得到名为< none>
。
After I make some changes to the myapp
source code, I run docker build -t myapp .
and I end up with images named <none>
.
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
myapp latest a38da0bd9e0b Less than a second ago ago 523.8 MB
<none> <none> e4209f97e819 10 minutes ago 523.8 MB
golang onbuild b4997c557048 10 days ago 517.2 MB
我知道我可以使用 docker rmi< IMAGE ID>
删除它们,但为什么会这样呢?如何防止这种情况发生?
I know I can remove them with docker rmi <IMAGE ID>
, but why does that happen in the first place? How can I prevent that from happening? The Dockerfile
I'm building looks like this.
FROM golang:onbuild
EXPOSE 8080
推荐答案
如果您重新分配标签或图像名称到另一个图像,您的图像将丢失其标签或名称。真的很简单您的 myapp
repo image tagged 最新
,ID为$ code> a38da0bd9e0b 在图片ID e4209f97e819
上命名和标记。
If you reassign a tag or image name to another image, your image will lose its tag or name. It's really that simple. Your myapp
repo image tagged latest
with ID a38da0bd9e0b
used to be named and tagged on image ID e4209f97e819
.
这篇关于什么是< none>存储库和标签?当我使用docker构建时,为什么它们出现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!