运行 Docker 注册表时 :2 是什么意思?
What does :2 mean when running Docker registry?
在我发现的关于 Docker 注册表的每个教程中,都有这样的命令:
docker run -d -p 5000:5000 --name registry registry:2
这里使用了标签2。为什么?我试过 registry 没有标签,它也有效。
我认为这与 Docker 注册表的不同 API (?) 有关,但我不确定。
关于 API,你是对的。来自 github.com/docker/distribution:
Distribution
The Docker toolset to pack, ship, store, and deliver content.
This repository's main product is the Docker Registry 2.0 implementation for storing and distributing Docker images. It supersedes the docker/docker-registry project with a new API design, focused around security and performance.
和:
registry
An implementation of the Docker Registry HTTP API V2 for use with docker 1.6+.
为什么两者都有效?
当你 docker pull registry
实际上 pull
registry:latest
并且它与 registry:2
具有相同的摘要。演示:
$ docker pull registry
Using default tag: latest
latest: Pulling from library/registry
169185f82c45: Already exists
046e2d030894: Pull complete
188836fddeeb: Pull complete
832744537747: Pull complete
7ceea07e80be: Pull complete
Digest: sha256:870474507964d8e7d8c3b53bcfa738e3356d2747a42adad26d0d81ef4479eb1b
Status: Downloaded newer image for registry:latest
$ docker pull registry:2
2: Pulling from library/registry
Digest: sha256:870474507964d8e7d8c3b53bcfa738e3356d2747a42adad26d0d81ef4479eb1b
Status: Downloaded newer image for registry:2
是的,你是对的!标记 2
表示 Docker Registry v2 实现,它也是 Docker Registry HTTP API V2。它解决了 V1
中的几个问题并引入了以下链接中描述的新功能:
通过删除 2
然后 docker 会转到名为 latest
的默认标签,该标签当前指向以下标签 2.7.1
、2.7
、2
。
因此,当 Docker Inc. 发布注册表 V3
时,latest
标记将指向 V3
,如果您需要特定的 V2
,则必须将其添加到你的命令明确。您可以查看 the available tags for the registry image
在我发现的关于 Docker 注册表的每个教程中,都有这样的命令:
docker run -d -p 5000:5000 --name registry registry:2
这里使用了标签2。为什么?我试过 registry 没有标签,它也有效。 我认为这与 Docker 注册表的不同 API (?) 有关,但我不确定。
关于 API,你是对的。来自 github.com/docker/distribution:
Distribution
The Docker toolset to pack, ship, store, and deliver content.
This repository's main product is the Docker Registry 2.0 implementation for storing and distributing Docker images. It supersedes the docker/docker-registry project with a new API design, focused around security and performance.
和:
registry
An implementation of the Docker Registry HTTP API V2 for use with docker 1.6+.
为什么两者都有效?
当你 docker pull registry
实际上 pull
registry:latest
并且它与 registry:2
具有相同的摘要。演示:
$ docker pull registry
Using default tag: latest
latest: Pulling from library/registry
169185f82c45: Already exists
046e2d030894: Pull complete
188836fddeeb: Pull complete
832744537747: Pull complete
7ceea07e80be: Pull complete
Digest: sha256:870474507964d8e7d8c3b53bcfa738e3356d2747a42adad26d0d81ef4479eb1b
Status: Downloaded newer image for registry:latest
$ docker pull registry:2
2: Pulling from library/registry
Digest: sha256:870474507964d8e7d8c3b53bcfa738e3356d2747a42adad26d0d81ef4479eb1b
Status: Downloaded newer image for registry:2
是的,你是对的!标记 2
表示 Docker Registry v2 实现,它也是 Docker Registry HTTP API V2。它解决了 V1
中的几个问题并引入了以下链接中描述的新功能:
通过删除 2
然后 docker 会转到名为 latest
的默认标签,该标签当前指向以下标签 2.7.1
、2.7
、2
。
因此,当 Docker Inc. 发布注册表 V3
时,latest
标记将指向 V3
,如果您需要特定的 V2
,则必须将其添加到你的命令明确。您可以查看 the available tags for the registry image