使用 nexus 3 代理私有 docker 注册表 [英] proxy private docker registry using nexus 3
问题描述
是否可以使用 nexus oss 3 代理在 docker 发行版上运行的私有 docker 注册表?
is it possible to proxy a private docker registry that runs on docker distribution using nexus oss 3?
我能够成功代理 Docker 集线器,但是当我尝试代理我自己的内部注册表时,我最终会遇到找不到图像的错误.
i am able to successfully proxy the docker hub, however when i try to proxy my own internal registry, i just end up with image not found errors.
2016-08-31 15:58:21,457+0000 WARN [qtp331814152-140] admin org.sonatype.nexus.repository.docker.internal.V1Handlers - Error: GET /v1/repositories/company-npm/images: 404 - org.sonatype.nexus.repository.docker.internal.V1Exception$ImagesNotFound: images not found
2016-08-31 15:58:30,764+0000 WARN [qtp331814152-140] admin org.sonatype.nexus.repository.docker.internal.V2Handlers - Error: GET /v2/library/company-java/manifests/latest: 404 - org.sonatype.nexus.repository.docker.internal.V2Exception: manifest unknown
2016-08-31 15:58:30,811+0000 WARN [qtp331814152-51] admin org.sonatype.nexus.repository.docker.internal.V1Handlers - Error: GET /v1/repositories/company-java/images: 404 - org.sonatype.nexus.repository.docker.internal.V1Exception$ImagesNotFound: images not found
2016-08-31 15:58:46,379+0000 WARN [qtp331814152-164] admin org.sonatype.nexus.repository.docker.internal.V2Handlers - Error: GET /v2/library/company-java/manifests/6.0.0: 404 - org.sonatype.nexus.repository.docker.internal.V2Exception: manifest unknown
该功能的文档似乎并未说明是否支持此功能.
the documentation for the feature does not seem to indicate if this is supported.
推荐答案
我在使用 Nexus 3.0.1-01 时遇到了同样的问题.对我来说,问题归结为命名空间.当命名空间留空时,Nexus 会为所有存储库访问命令插入/library 命名空间.请参阅 https://books.sonatype.com/nexus-book/3.0/参考/docker.html 9.8 节.
I had this same issue with Nexus 3.0.1-01. For me the problem came down to namespacing. Nexus inserts the /library namespace for all repository access commands when a namespace is left blank. See https://books.sonatype.com/nexus-book/3.0/reference/docker.html section 9.8.
例如,如果我将图像推送到托管存储库:
So for example if I push an image to a hosted repository:
docker push my-registry.com:5000/myimage:latest
代理注册表查找图像为:
The proxy registry looks for the image as:
docker pull my-registry.com:5000/library/myimage:latest
当然不存在.(如果 Nexus 会在图像推送时自动添加/library 命名空间,或者至少使其成为存储库级别的可配置选项,那就太好了).
Which of course doesn't exist. (It would be really great if Nexus would add the /library namespace automatically on image push, or at least make this a configurable option at the repo level).
如果您要执行以下操作:
If you were to do the following:
docker push my-registry:5000/library/myimage:latest
甚至:
docker push my-registry:5000/mynamespace/myimage:latest
您的代理将能够找到该图像.
The your proxy will be able to find the image.
docker pull my-proxy-registry:5000/mynamespace/myimage:latest
这篇关于使用 nexus 3 代理私有 docker 注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!