本文介绍了gcloud docker push 403禁止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将docker映像推送到eu.gcr.io,并且我收到403 Forbidden
I am trying to push a docker image to eu.gcr.io and I am getting 403 Forbidden
gcloud docker push eu.gcr.io/<projectname>/<image>:latest
The push refers to a repository [eu.gcr.io/<projectname>/<image>] (len: 1)
663cd9de01fe: Preparing
Post https://eu.gcr.io/v2/w<projectname>/<image>/blobs/uploads/: token auth attempt for registry: https://eu.gcr.io/v2/token?account=_token&scope=repository%3A<projectname>%2F<image>3Apush%2Cpull&service=eu.gcr.io request failed with status: 403 Forbidden
我已经检查了
- 卷曲 https://eu.gcr.io/v1/_ping =>可以正常运行
- gcloud配置列表=>已设置项目ID
- 在控制台中启用了存储api
- 如果我在url中使用项目名称,则会显示403 Forbidden
- 如果我在url中使用项目ID,则会显示存储库不存在"
- gcloud身份验证列表=>将所有者显示为活动
- gcloud组件更新=>所有组件都是最新的.
- curl https://eu.gcr.io/v1/_ping => works
- gcloud config list => project id is setup
- Storage api is enabled in console
- if I use the project name in the url I get 403 Forbidden
- if I use the project id in the url I get "Repository does not exist"
- gcloud auth list => shows the owner as active
- gcloud components update => All components are up to date.
推荐答案
我也遇到了同样的问题,请按顺序解决.
I had faced the same issue, to resolve it in order I done.
- 按照提示重命名图像
- 将用户添加到docker组(对于docker登录很重要)
- 使用docker登录令牌 https://cloud.google.com/container-registry/docs/auth
docker login -e 1234@5678.com -u _token -p "$(gcloud auth print-access-token)" https://gcr.io
(如果使用sudo docker
,则令牌将与根帐户一起存储.)
(If using sudo docker
, the token will be stored with the root account.)
然后根据如何使用docker push gcr.io/projetc_id/imagename
将Docker映像推送到私有存储库中
Then use docker push gcr.io/projetc_id/imagename
according to How to push a docker image to a private repository
这篇关于gcloud docker push 403禁止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!