harbor 中 使用 upload 上传镜像时候 显示 没有认证
概述:
VMware harbor 安装完成后,
使用docker tag 打新的标签,
然后 用docker push上传镜像的时候,
显示 安全方面的错误。
1.客户端显示信息
[root@ip-172-30-0-20 ~]# docker push 172.30.0.20:5000/busybox:cloud
The push refers to a repository [172.30.0.20:5000/busybox]
5f70bf18a086: Image push failed
1834950e52ce: Image push failed
unauthorized: authentication required
[root@ip-172-30-0-20 ~]#
2. 服务器端:
registry_1 |time="2016-06-08T11:02:29.929222341Z" level=debugmsg="authorizing request" go.version=go1.6.1http.request.host="172.30.0.20:5000"http.request.id=300a9dbe-6027-41bb-a9a3-64e7eaf68f76 http.request.method=GEThttp.request.remoteaddr="172.30.0.20:41271"http.request.uri="/v2/"http.request.useragent="docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"instance.id=71df9a7e-0ec8-4522-8978-bbd01813541f service=registry version=v2.4.0
registry_1 |time="2016-06-08T11:02:29.929388489Z" level=warning msg="errorauthorizing context: authorization token required" go.version=go1.6.1http.request.host="172.30.0.20:5000" http.request.id=300a9dbe-6027-41bb-a9a3-64e7eaf68f76http.request.method=GET http.request.remoteaddr="172.30.0.20:41271"http.request.uri="/v2/"http.request.useragent="docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64" instance.id=71df9a7e-0ec8-4522-8978-bbd01813541fservice=registry version=v2.4.0
registry_1 | 172.30.0.20 - -[08/Jun/2016:11:02:29 +0000] "GET /v2/ HTTP/1.1" 401 87 """docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"
ui_1 | 2016-06-08T11:02:29Z [INFO]request url:/service/token?scope=repository%3Abusybox%3Apush%2Cpull&service=token-service
ui_1 | 2016-06-08T11:02:29Z[DEBUG] [authenticator.go:52]: Current AUTH_MODE is db_auth
ui_1 | 2016-06-08T11:02:29Z[DEBUG] [authutils.go:42]: scopes: [repository:busybox:push,pull]
ui_1 | 2016-06-08T11:02:29Z [INFO]current access, type: repository, name:busybox, actions:[]
ui_1 | 2016/06/08 11:02:29[router.go:828][D] | GET |/service/token | 36.754061ms | match | /service/token |
registry_1 |time="2016-06-08T11:02:29.973905388Z" level=debugmsg="authorizing request" go.version=go1.6.1http.request.host="172.30.0.20:5000"http.request.id=f7031b1d-2055-43db-8bcc-a587d95dc1bf http.request.method=HEADhttp.request.remoteaddr="172.30.0.20:41275"http.request.uri="/v2/busybox/blobs/sha256:385e281300cc6d88bdd155e0931fbdfbb1801c2b0265340a40481ee2b733ae66"http.request.useragent="docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"instance.id=71df9a7e-0ec8-4522-8978-bbd01813541f service=registryvars.digest="sha256:385e281300cc6d88bdd155e0931fbdfbb1801c2b0265340a40481ee2b733ae66"vars.name=busybox version=v2.4.0
registry_1 | time="2016-06-08T11:02:29.974703102Z"level=warning msg="error authorizing context: insufficient scope"go.version=go1.6.1 http.request.host="172.30.0.20:5000"http.request.id=f7031b1d-2055-43db-8bcc-a587d95dc1bf http.request.method=HEADhttp.request.remoteaddr="172.30.0.20:41275"http.request.uri="/v2/busybox/blobs/sha256:385e281300cc6d88bdd155e0931fbdfbb1801c2b0265340a40481ee2b733ae66"http.request.useragent="docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"instance.id=71df9a7e-0ec8-4522-8978-bbd01813541f service=registryvars.digest="sha256:385e281300cc6d88bdd155e0931fbdfbb1801c2b0265340a40481ee2b733ae66"vars.name=busybox version=v2.4.0
registry_1 | 172.30.0.20 - -[08/Jun/2016:11:02:29 +0000] "HEAD /v2/busybox/blobs/sha256:385e281300cc6d88bdd155e0931fbdfbb1801c2b0265340a40481ee2b733ae66HTTP/1.1" 401 139 "" "docker/1.10.3-cs3 go/go1.5.4git-commit/6df5588 kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"
registry_1 |time="2016-06-08T11:02:29.975992181Z" level=debugmsg="authorizing request" go.version=go1.6.1http.request.host="172.30.0.20:5000"http.request.id=2aed3a1d-8bd2-4b4a-9507-9aa01f76d009 http.request.method=HEADhttp.request.remoteaddr="172.30.0.20:41274" http.request.uri="/v2/busybox/blobs/sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"http.request.useragent="docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"instance.id=71df9a7e-0ec8-4522-8978-bbd01813541f service=registryvars.digest="sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"vars.name=busybox version=v2.4.0
registry_1 |time="2016-06-08T11:02:29.976514194Z" level=warning msg="errorauthorizing context: insufficient scope" go.version=go1.6.1http.request.host="172.30.0.20:5000"http.request.id=2aed3a1d-8bd2-4b4a-9507-9aa01f76d009 http.request.method=HEADhttp.request.remoteaddr="172.30.0.20:41274"http.request.uri="/v2/busybox/blobs/sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"http.request.useragent="docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"instance.id=71df9a7e-0ec8-4522-8978-bbd01813541f service=registryvars.digest="sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"vars.name=busybox version=v2.4.0
registry_1 | 172.30.0.20 - -[08/Jun/2016:11:02:29 +0000] "HEAD/v2/busybox/blobs/sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4HTTP/1.1" 401 139 "" "docker/1.10.3-cs3 go/go1.5.4git-commit/6df5588 kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"
proxy_1 | 54.172.254.196 - -[08/Jun/2016:11:02:29 +0000] "GET/service/token?scope=repository%3Abusybox%3Apush%2Cpull&service=token-serviceHTTP/1.1" 200 1157 "-" "docker/1.10.3-cs3 go/go1.5.4git-commit/6df5588 kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"
3. 解决:
a)先 登录
docker login -u admin -p Harbor12345 -e [email protected] 172.30.0.20:5000
[root@ip-172-30-0-20 ~]# docker login -u admin -p Harbor12345 [email protected] 172.30.0.20:5000
WARNING: login credentials saved in /root/.docker/config.json
Login Succeeded
[root@ip-172-30-0-20 ~]#
b)文件内容
"auths": {
"172.30.0.20:5000": {
"auth":"YWRtaW46SGFyYm9yMTIzNDU=",
"email": "[email protected]"
}
}
}
c)服务器端输出
registry_1 |time="2016-06-08T11:08:27.101055472Z" level=debugmsg="authorizing request" go.version=go1.6.1http.request.host="172.30.0.20:5000"http.request.id=4fb2a7ec-9446-4e09-8c13-5fb71f091261 http.request.method=GEThttp.request.remoteaddr="172.30.0.20:41278"http.request.uri="/v2/"http.request.useragent="docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"instance.id=71df9a7e-0ec8-4522-8978-bbd01813541f service=registryversion=v2.4.0
registry_1 |time="2016-06-08T11:08:27.101137779Z" level=warning msg="errorauthorizing context: authorization token required" go.version=go1.6.1http.request.host="172.30.0.20:5000"http.request.id=4fb2a7ec-9446-4e09-8c13-5fb71f091261 http.request.method=GEThttp.request.remoteaddr="172.30.0.20:41278"http.request.uri="/v2/"http.request.useragent="docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"instance.id=71df9a7e-0ec8-4522-8978-bbd01813541f service=registryversion=v2.4.0
registry_1 | 172.30.0.20 - -[08/Jun/2016:11:08:27 +0000] "GET /v2/ HTTP/1.1" 401 87 """docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"
ui_1 | 2016-06-08T11:08:27Z [INFO]request url: /service/token?account=admin&service=token-service
ui_1 | 2016-06-08T11:08:27Z[DEBUG] [authenticator.go:52]: Current AUTH_MODE is db_auth
ui_1 | 2016-06-08T11:08:27Z[DEBUG] [authutils.go:42]: scopes: []
ui_1 | 2016/06/08 11:08:27[router.go:828][D] | GET |/service/token | 29.821542ms | match | /service/token |
registry_1 |time="2016-06-08T11:08:27.137128678Z" level=debugmsg="authorizing request" go.version=go1.6.1http.request.host="172.30.0.20:5000"http.request.id=6a912eb4-3932-43fe-bdff-6e84c45d70a4 http.request.method=GEThttp.request.remoteaddr="172.30.0.20:41281"http.request.uri="/v2/"http.request.useragent="docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"instance.id=71df9a7e-0ec8-4522-8978-bbd01813541f service=registry version=v2.4.0
registry_1 |time="2016-06-08T11:08:27.13791445Z" level=info msg="responsecompleted" go.version=go1.6.1http.request.host="172.30.0.20:5000"http.request.id=6a912eb4-3932-43fe-bdff-6e84c45d70a4 http.request.method=GEThttp.request.remoteaddr="172.30.0.20:41281" http.request.uri="/v2/"http.request.useragent="docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"http.response.contenttype="application/json; charset=utf-8"http.response.duration=1.934938ms http.response.status=200http.response.written=2 instance.id=71df9a7e-0ec8-4522-8978-bbd01813541fservice=registry version=v2.4.0
registry_1 | 172.30.0.20 - -[08/Jun/2016:11:08:27 +0000] "GET /v2/ HTTP/1.1" 200 2 """docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588 kernel/3.10.0-327.el7.x86_64os/linux arch/amd64"
proxy_1 | 54.172.254.196 - admin[08/Jun/2016:11:08:27 +0000] "GET/service/token?account=admin&service=token-service HTTP/1.1" 200 1099"-" "docker/1.10.3-cs3 go/go1.5.4 git-commit/6df5588kernel/3.10.0-327.el7.x86_64 os/linux arch/amd64"
d) 上传 image客户端
[root@ip-172-30-0-20 ~]# docker tag busybox 172.30.0.20:5000/library/my
[root@ip-172-30-0-20 ~]# docker push 172.30.0.20:5000/library/my
The push refers to a repository [172.30.0.20:5000/library/my]
5f70bf18a086: Pushed
1834950e52ce: Pushed
latest: digest:sha256:6757d4b17cd75742fc3b1fc1a8d02b45b637f2ac913ee9669f5c2aed0c9b26ba size:711
[root@ip-172-30-0-20 ~]#
e)服务器端输出 (部分)
。。。。。。。。
ui_1 | 2016/06/08 11:30:57[router.go:828][D] | POST |/service/notifications | 190.034µs | match | /service/notifications |
ui_1 | 2016/06/08 11:30:57[router.go:828][D] | POST |/service/notifications | 129.273µs | match | /service/notifications | ))