我正在尝试将图像推送到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
和read_repository
令牌给read_registry
。
我的仓库是:
https://gitlab.com/mycompany/rgpd_api
我检查了以下文档页面:https://docs.gitlab.com/ee/user/project/container_registry.html
但是当我通过Gitlab CI使用gitlab-ci-token
我可以正常推它。
我还试图重新生成新令牌,但仍然是同一问题。
我该如何解决?
答案 0 :(得分:0)
我的错误是使用部署令牌将映像推送到注册表。
部署令牌可用于拉取图像,但不能推送图像。
因此,您可以生成一个个人访问令牌。您应该至少添加权限:
read_registry, write_registry