当我尝试从我的本地镜像拉取图像时,它可以正常工作:
$ docker login -u docker -p mypassword nexus3.pleiade.mycomp.fr:5000
$ docker pull nexus3.pleiade.mycomp.fr:5000/hello-world
Using default tag: latest
latest: Pulling from **hello-world**
78445dd45222: Pull complete
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
Status: Downloaded newer image for **nexus3.pleiade.mycomp.fr:5000/hello-world:latest**
但是,当我想将此注册表用作镜像时,它会被忽略,图像总是从web Docker hub中获取,而不是从我的本地镜像中获取:
$ ps -ef | grep docker
/usr/bin/dockerd -H fd:// --storage-driver=overlay2 --registry-mirror=https://nexus3.pleiade.mycomp.fr:5000
$ docker info
Registry Mirrors:
https://nexus3.pleiade.mycomp.fr:5000/
$ docker rmi nexus3.pleiade.mycomp.fr:5000/hello-world
_
$ docker pull hello-world
Using default tag: latest
latest: Pulling from **library/hello-world**
78445dd45222: Pull complete
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
Status: Downloaded newer image for **hello-world:latest**
我确定它没有使用我的镜像,因为当我取消代理设置时,它无法访问hello-world镜像。
这是Docker的bug吗?还是我漏掉了什么?
Docker信息(简要):
Server Version: 1.13.1
Storage Driver: overlay2
(...)
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.8.0-37-generic
Operating System: Ubuntu 16.10
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 15.67 GiB
(...)
Registry Mirrors:
https://nexus3.pleiade.edf.fr:5000/
更新:
通过执行"journalctl -xe"命令,我看到了一些有用的信息:
level=error msg="尝试在错误后拉取下一个端点:获取 https://nexus3.pleiade.mycomp.fr:5000/v2/library/hello-world/manifests/latest 时出错:没有基本身份验证凭据"
这似乎与https://github.com/docker/docker/issues/20097有关,但解决方法不起作用:当我将--registry-mirror=https://nexus3.pleiade.mycomp.fr:5000替换为--registry-mirror=https://docker:password@nexus3.pleiade.mycomp.fr:5000时,我得到了完全相同的错误。
如果有影响的话,Nexus使用自签名证书,该证书已复制到/etc/docker/certs.d/nexus3.pleiade.mycomp.fr:5000/ca.crt,并且这允许通过“docker login”进行登录。
https://nexus3.pleiade.mycomp.fr:5000
是否是内部托管的?如果是,则尝试添加no_proxy=nexus3.pleiade.mycomp.fr
。 - Nehal J Wani