以下命令的解释是否正确?
我的解释:创建一个名为“registry”的注册表,该注册表侦听映射到主机端口5001的容器的端口5002.
另外,我不明白“注册表:2”需要什么?看起来像是“repository_name:tag”,它相当于图像名称.它是否正确?
docker run -d -p 5001:5002 --restart=always --name registry registry:2
此外,我尝试使用“注册表:1”和“注册表:3”,这是行不通的.它只在我使用“registry:2”时才有效.
✘ ~ docker run -d -p 5001:5002 --restart=always --name new_registry registry:3
Unable to find image 'registry:3' locally
Pulling repository docker.io/library/registry
Tag 3 not found in repository docker.io/library/registry
✘ ~ docker run -d -p 5001:5002 --restart=always --name new_registry registry:1
Unable to find image 'registry:1' locally
Pulling repository docker.io/library/registry
Tag 1 not found in repository docker.io/library/registry
最佳答案 正如 official registry image中提到的那样
>标签> = 2参考new registry.
>较旧的标签参考deprecated registry.
Deploying a registry server页面使用新的注册表服务器(具有更简单的映射):
docker run -d -p 5000:5000 --restart=always --name registry registry:2
这仅适用于localhost访问,因为从其他主机访问它将需要ssl证书.
docker run -d -p 5000:5000 --restart=always --name registry \
-v `pwd`/certs:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
registry:2
OP Zack增加了in the comments:
It seems that it does not work for tags = 3
那是因为official page只列出了以下标签:
2, 2.2, 2.2.0 (07007)
没有标签3.