我正在尝试将图像推送到 gitlab 注册表。
我已经做过很多次了,所以我想知道为什么会出现这个错误。
我用最新的标签构建图像:
Successfully tagged registry.gitlab.com/mycompany/rgpd_api:latest
然后我登录并推送:
docker login registry.gitlab.com -u gitlab+deploy-token-91931
docker push registry.gitlab.com/mycompany/rgpd_api:latest
但我得到:
The push refers to repository [registry.gitlab.com/mycompany/rgpd_api]
be679cc302b9: Preparing
denied: requested access to the resource is denied
我给了
gitlab+deploy-token-91931
token 两者 read_repository
和 read_registry
权利。我的 repo 是:
https://gitlab.com/mycompany/rgpd_api
我检查了文档页面:https://docs.gitlab.com/ee/user/project/container_registry.html
但是当我通过 Gitlab CI 进行时,使用
gitlab-ci-token
我可以正常推送。
我也尝试重新生成一个新的 token ,但仍然是同样的问题。
我该如何解决?
最佳答案
我的错误是使用部署 token 将图像推送到注册表。
部署 token 可用于拉取镜像,但不能推送它。
因此,您可以生成个人访问 token 。您应该至少添加权限:
read_registry, write_registry
关于docker - 拒绝 : requested access to the resource is denied when pushing image to gitlab registry,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57654620/