映像和存储库之间有什么区别? [英] What is the difference between an image and a repository?

查看:65
本文介绍了映像和存储库之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Docker的新手,并遵循入门教程。在第7步中,它显示

I am brand new to Docker and following the Getting Started tutorial. At step 7 it says


键入 docker images 命令,然后按RETURN。该命令列出了本地系统上的所有映像。您应该在列表中看到 docker / whalesay

type docker images command and press RETURN. The command lists all the images on your local system. You should see docker/whalesay in the list.

$ docker images
REPOSITORY           TAG         IMAGE ID            CREATED            VIRTUAL SIZE
docker/whalesay      latest      fb434121fc77        3 hours ago        247 MB
hello-world          latest      91c95931e552        5 weeks ago        910 B


,但第一列明确表示存储库,例如图片名称。我还注意到在其他人的机器上,由于一张图片可以包含多个标签,因此该清单通常包含重复的条目-每个标签一个。那么,这是图像列表,存储库列表,图像标签组合列表还是其他东西吗?图像和存储库之间有什么区别?

but the first column clearly says "repository", not e.g. "image name". I have also noticed on other people's machines that, because an image can have multiple tags, this listing often contains duplicate entries - one for each tag. So is this a list of images, a list of repositories, a list of image-tag combinations or something else? What is the difference between an image and a repository?

此外,由于图像和存储库是不同的东西,我该如何列出我的存储库?

Also, given that images and repositories are different things, how can I just list my repositories?

这与容器无关。

推荐答案

是的,这是非常令人困惑的术语。

Yes, this is very confusing terminology.

最简单的答案:

图片:单个图片。

存储库:图像的集合。

详细信息:

图片:图片ID 唯一引用的12位十六进制代码(例如91c95931e552)。 [1]

Image: Uniquely referenced by the Image ID, the 12 digit hex code (e.g. 91c95931e552). [1]

存储库:包含一个或多个图像。因此, hello-world 存储库可以包含两个不同的图像: 91c95931e552 1234abcd5678

Repository: Contains one or more images. So the hello-world repository could contain two different images: 91c95931e552 and 1234abcd5678.

图片别名-我要定义图片别名表示引用特定图像的别名。 图像别名的格式为 repository:tag 。这样,您可以使用人类友好的别名,例如 hello-world:latest 而不是12位代码。

Image alias - I'm going to define image alias to mean an alias that references a specific image. The format of an image alias is repository:tag. This way, you can use a human-friendly alias such as hello-world:latest instead of the 12-digit code.

示例:

比方说我有这些图像:

REPOSITORY           TAG         IMAGE ID
docker/whalesay      latest      fb434121fc77
hello-world          latest      91c95931e552
hello-world          v1.1        91c95931e552
hello-world          v1.0        1234abcd5678

存储库为: docker / whalesay hello-world

图片为 fb434121fc77 91c95931e552 1234abcd5678 。请注意,第二行和第三行具有相同的图片ID ,因此它们是同一张图片。

The images are fb434121fc77, 91c95931e552, 1234abcd5678. Notice that the 2nd and 3rd rows have the same Image ID, so they are the same image.

图片别名是:

docker/whalesay:latest
hello-world:latest
hello-world:v1.1
hello-world:v1.0

所以 hello -world:latest hello-world:v1.1 只是同一张图片的两个别名。

So hello-world:latest and hello-world:v1.1 are simply two aliases for the same image.

其他详细信息:


  • 存储库名称格式也可以添加可选的用户或名称空间,这在使用公共注册中心(如Docker Hub)时非常有用。例如。 docker / whalesay 。否则,您将有很多存储库名称冲突。

  • Repository name format can also prepend an optional user or namespace, which is useful when using a public registry like Docker Hub. E.g. docker/whalesay. Otherwise, you will have a lot of repository name conflicts.

如果在以下情况下省略了标记引用图片别名,它将自动添加:latest 。因此,当您指定 hello-world 时,它将被解释为 hello-world:latest 。警告:最新实际上并不意味着什么特别的,它只是一个默认标记。

If you leave out the tag when referencing an image alias, it will automatically add :latest. So when you specify hello-world, it will be interpreted as hello-world:latest. Warning: latest doesn't actually mean anything special, it's just a default tag.

[1] 实际上,完整的图像ID是一个64位十六进制代码,会被截断为12位数字,但是您不必担心。

[1] Actually, the full Image ID is a 64 digit hex code truncated to 12 digits, but you don't need to care about that.

这篇关于映像和存储库之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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