docker - 拒绝 : requested access to the resource is denied when pushing image to gitlab registry

标签 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-91931 token 两者 read_repositoryread_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/

相关文章:

docker - 在另一个 compose 文件中导入 docker compose 文件

python - 在 Docker 中使用 starlette 实现 SSL

ruby-on-rails - Gitlab 架构 - Rails Postgresql

python - 在 OpenShift 上使用 pip 安装 Git 托管的模块

docker - 推送到私有(private)Docker v2注册表会出现错误: Manifest invalid

c++ - 我如何使用注册表?

windows - 如何在 Windows 上同时运行 Docker 和 Android Studio Emulator?

selenium - 在 docker 中执行机器人测试时见 firefox

git - gitlab 上删除的一个分支,在命令行中还存在吗?

windows - 如何为 Electron 应用程序设置 ProgId?