我创建了一个docker注册表镜像,如下所示:
docker run -d -p 5000:5000 -e REGISTRY_PROXY_REMOTEURL=https://registry.gitlab.com --restart always --name registry registry:2
我可以curl
到注册表:
$ curl REGISTRY_ADDRESS:5000/v2/
{}
当我尝试下载图片时:
docker run REGISTRY_ADDRESS:5000/group/project:tag
我得到了:
Unable to find image 'REGISTRY_ADDRESS:5000/group/project:tag' locally
docker: Error response from daemon: manifest for
REGISTRY_ADDRESS:5000/group/project:tag not found.
在docker logs
我可以看到以下内容:
time="2018-02-19T15:08:19Z" level=info msg="listening on [::]:5000" go.version=go1.7.6 instance.id=_____ version=v2.6.2
time="2018-02-19T15:08:58Z" level=info msg="response completed" go.version=go1.7.6 http.request.host="______:5000" http.request.id=28323951-f6f5-4386-b608-9e806507527a http.request.method=GET http.request.remoteaddr="______:35098" http.request.uri="/v2/" http.request.useragent="docker/17.12.0-ce go/go1.9.2 git-commit/c97c6d6 kernel/4.4.0-112-tag os/linux arch/amd64 UpstreamClient(Docker-Client/17.12.0-ce \\(linux\\))" http.response.contenttype="application/json; charset=utf-8" http.response.duration=3.027696ms http.response.status=200 http.response.written=2 instance.id=_______ version=v2.6.2
10.135.29.97 - - [19/Feb/2018:15:08:58 +0000] "GET /v2/ HTTP/1.1" 200 2 "" "docker/17.12.0-ce go/go1.9.2 git-commit/c97c6d6 kernel/4.4.0-112-tag os/linux arch/amd64 UpstreamClient(Docker-Client/17.12.0-ce \\(linux\\))"
time="2018-02-19T15:08:59Z" level=info msg="Challenge established with upstream : {https <nil> registry.gitlab.com /v2/ %!s(bool=false) } &{{{%!s(int32=0) %!s(uint32=0)} %!s(uint32=0) %!s(uint32=0) %!s(int32=0) %!s(int32=0)} map[https://registry.gitlab.com:443/v2/:[{bearer map[realm:https://gitlab.com/jwt/auth service:container_registry]}]]}" go.version=go1.7.6 http.request.host="_____:5000" http.request.id=c4db88c1-c2d4-4bd2-9731-904fe05f99ca http.request.method=GET http.request.remoteaddr="______:35100" http.request.uri="/v2/group/project/manifests/tag" http.request.useragent="docker/17.12.0-ce go/go1.9.2 git-commit/c97c6d6 kernel/4.4.0-112-tag os/linux arch/amd64 UpstreamClient(Docker-Client/17.12.0-ce \\(linux\\))" instance.id=______ vars.name="group/project" vars.reference=tag version=v2.6.2
time="2018-02-19T15:08:59Z" level=error msg="response completed with error" err.code="manifest unknown" err.detail="unknown tag=tag" err.message="manifest unknown" go.version=go1.7.6 http.request.host="_____:5000" http.request.id=_____ http.request.method=GET http.request.remoteaddr="_____:35100" http.request.uri="/v2/group/project/manifests/tag" http.request.useragent="docker/17.12.0-ce go/go1.9.2 git-commit/c97c6d6 kernel/4.4.0-112-tag os/linux arch/amd64 UpstreamClient(Docker-Client/17.12.0-ce \\(linux\\))" http.response.contenttype="application/json; charset=utf-8" http.response.duration=815.410843ms http.response.status=404 http.response.written=97 instance.id=_______ vars.name="group/project" vars.reference=tag version=v2.6.2
10.135.29.97 - - [19/Feb/2018:15:08:58 +0000] "GET /v2/group/project/manifests/tag HTTP/1.1" 404 97 "" "docker/17.12.0-ce go/go1.9.2 git-commit/c97c6d6 kernel/4.4.0-112-tag os/linux arch/amd64 UpstreamClient(Docker-Client/17.12.0-ce \\(linux\\))"
从错误中我无法说明注册表镜像是否设法连接到gitlab,这会拒绝连接或是否甚至没有尝试。我已经搜索了所有用于创建私有注册表的手册,但似乎没有人有同样的问题。
编辑
我觉得特别奇怪这一部分:
Challenge established with upstream : {https <nil> registry.gitlab.com}
http.request.remoteaddr="10.135.29.97:33144"
但我想remoteaddr
应该是gitlab的地址,但这是我的私人本地地址。