1.问题描述
在GCP上构建完镜像后,想执行docker push
相应镜像上去的时候发现返回一个问题:
The push refers to repository [gcr.io/starcloud-200123/clustarai/jupyterhub]
09ecd2b03c9e: Pushing [==================================================>] 4.096kB
f31f4bf3457c: Pushing [> ] 527.9kB/69.27MB
cf68b15b6692: Pushing [> ] 1.105MB/74.6MB
29acdb82cf33: Pushing [> ] 1.082MB/293.4MB
cf566301e886: Pushing 2.048kB
8f189fbdd4a2: Waiting
19a80dc8352a: Waiting
113186be4250: Waiting
d4b799819dc9: Waiting
018bab9514b6: Waiting
2c978c65bb8c: Waiting
451a19b61031: Waiting
cce972c37edc: Waiting
bb1eed35aacf: Waiting
5fc1dce434ba: Waiting
c4f90a44515b: Waiting
a792400561d8: Waiting
6a4e481d02df: Waiting
denied: Access denied.
解决这个问题,主要是GCP本身的机器人文档实在是太难读懂了。。。
2.解决
解决这个问题也就是一个权限问题,首先你的GCP账户本身是有对这个项目进行修改的权限的,接着你需要执行以下步骤。
- 1.登入你的GCP账号,一般是google账号
$ gcloud auth login
在这里面输入你的用户名,然后复制一条链接到浏览器中,拿到一个verification code,填里面即可。
- 2.设置到你的project
$ gcloud config set project starcloud-200123 # starcloud-200123需要改成你自己的project
输出:
Updated property [core/project].
- 3.确认docker配置
$ gcloud auth configure-docker
输出:
gcloud credential helpers already registered correctly.
- 4.login你的位置
$ docker login gcr.io # gcr.io需要改成你自己的project位置
输出:
Authenticating with existing credentials...
Login Succeeded
- 5.push 你的镜像
$ docker push gcr.io/starcloud-200123/clustarai/jupyterhub
输出:
The push refers to repository [gcr.io/starcloud-200123/clustarai/jupyterhub]
09ecd2b03c9e: Pushed
f31f4bf3457c: Pushed
cf68b15b6692: Pushed
29acdb82cf33: Pushed
cf566301e886: Pushed
8f189fbdd4a2: Pushed
19a80dc8352a: Pushed
113186be4250: Pushed
d4b799819dc9: Pushed
018bab9514b6: Pushed
2c978c65bb8c: Pushed
451a19b61031: Pushed
cce972c37edc: Pushed
bb1eed35aacf: Pushed
5fc1dce434ba: Pushed
c4f90a44515b: Pushed
a792400561d8: Pushed
6a4e481d02df: Pushed
v1: digest: sha256:62e6c6614ec3b628cbc17dce62307194288c3c72b2f2fc53e7e6ef1cb2c3eb46 size: 4079
网友评论