拒绝:将映像推送到gitlab注册表时,拒绝对资源的请求访问

时间:2019-08-26 08:49:07

标签: docker gitlab registry gitlab-ci

我正在尝试将图像推送到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-91931read_repository令牌给read_registry

我的仓库是:

https://gitlab.com/mycompany/rgpd_api

我检查了以下文档页面:https://docs.gitlab.com/ee/user/project/container_registry.html

但是当我通过Gitlab CI使用gitlab-ci-token

时,

我可以正常推它。

我还试图重新生成新令牌,但仍然是同一问题。

我该如何解决?

1 个答案:

答案 0 :(得分:0)

我的错误是使用部署令牌将映像推送到注册表。

部署令牌可用于拉取图像,但不能推送图像。

因此,您可以生成一个个人访问令牌。您应该至少添加权限:

read_registry, write_registry