我正在按照这个链接创建我的第一个docker映像,它成功了,现在我试图从这个链接将这个映像推到我的docker存储库中。但是每当我试图将这个映像推入存储库时,我就会得到这种类型的错误。

denied: requested access to the resource is denied

注:我已成功登录docker


当前回答

在使用Gitlab注册表时,我还遇到了这个错误消息。不同之处在于,我试图从以前的构建中更改映像的名称。这里的问题是,推送图像的注册表不存在,因为图像的新名称与我组中的任何项目都不匹配。

TLDR:在Gitlab中,映像名称必须与项目名称匹配。

其他回答

有一个docker文件,要求是立即构建一个映像并将其推送到docker hub

登录Docker集线器 Sudo docker login -u your_username 输入密码 构建映像 Sudo docker build -t your_username/demorepo:1.0 上面没有提到图像名称,因为your_username/demorepo是一个 在docker中心回购。标签名称为1.0 推送图片 Sudo docker推送your_username/demorepo:1.0

将已经存在的图像推送到Docker中心

Login to the Docker hub sudo docker login -u your_username Enter password Tag your image(suppose your image is named as test_docker:1.0) sudo docker tag test_docker:1.0 your_username/demorepo:firstpush Above, firstpush is the tag name given to your image, test_docker with 1.0 Tag. IMPORTANT : (While tagging, the image name is not mentioned) Now in docker images you will have 2 images, one says test_docker 1.0 and the other your_username/demorepo firstpush Push the image sudo docker push your_username/demorepo:firstpush

我真的希望这能帮助到一些人(像我一样先看最终答案的人):

我不断地尝试输入

docker push user/repo/tag

而不是

docker push user/repo:tag

因为我也这样做了我的标签:

docker tag image user/repo/tag

...一切都毁了。

我真诚地希望你不要重蹈我的覆辙。我在这上面浪费了30分钟…

尝试签出“Docker for Windows”应用程序和签出https://hub.docker.com/网站后执行“Docker登录”和“Docker推送”。 这对我很有帮助。

之前的答案都是正确的,我只是想补充一个我看到没有提到的信息;

如果项目是私有项目,要正确地推送映像,必须配置个人访问令牌或启用read_registry key的部署令牌。

来源:https://gitlab.com/help/user/project/container_registry using-with-private-projects

希望这是有帮助的(如果问题是张贴到目前为止的时间)

我的答案与Azure DevOps相关,类似于我在以下通用管道中遇到的问题(它更具体,但它可能有助于节省时间):

从github获取资源 构建docker映像 推送docker镜像到dockerhub

我在推送拒绝时收到的错误:对资源的请求访问被拒绝发送到这里。

请注意映像名称中包含的变量$(Build.Repository.Name)。它默认是来自github的存储库名称,但为了让您的推送工作,它应该是dockerhub_account_username/your_dockerhub_repository_name。

将$(build . repository . name)替换为dockerhub_account_username/your_dockerhub_repository_name在映像名称字段中用于构建和推送步骤。

dockerhub api需要这一点来知道在哪里推送图像。