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

denied: requested access to the resource is denied

注:我已成功登录docker


当前回答

当我在标记图像时使用docker中心名时,它为我工作。(这里,xyz是一个docker中心名)

# Login to docker hub account 
docker login 

# tag image 
docker tag nginx xyz/nginx

# push image
docker push xyz/nginx

其他回答

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

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

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

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

如果您已经登录,如果您仍然得到错误。请按照步骤操作,

PS C:\Users\rohit\Docker> docker logout
Removing login credentials for https://index.docker.io/v1/

PS C:\Users\rohit\Docker> docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: rohithpoya
Password:*****************
Login Succeeded

Logging in with your password grants your terminal complete access to your account.
For better security, log in with a limited-privilege personal access token. Learn more at https://docs.docker.com/go/access-tokens/

PS C:\Users\rohit\Docker> docker push rohithpoya/mongo-enterprise:5                                                                                                                                                                       
The push refers to repository [docker.io/rohithpoya/mongo-enterprise]                                                                                                                                                                        83ee27b8fe98: Pushed

还需要注意的重要一点是,在标记图像时,首先使用命名空间标记,然后使用存储库/ mydevrepo标记。这让我在使用Docker文档时感到困惑。之后我使用:

docker login

然后我使用“tagged name”来推送我的图像。

docker push {namespace}/mydevrepo

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

我不断地尝试输入

docker push user/repo/tag

而不是

docker push user/repo:tag

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

docker tag image user/repo/tag

...一切都毁了。

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

在我的例子中,我被推送到一个组织,我所在的团队对存储库有管理权限。

所以我的推送命令是: Docker push org-name/image-name

我可以成功地推到用户名/image-name,但不能推到组织。我再三检查了权限。毫无效果。

解决方案是从docker hub中删除repo,并再次使用: Docker push org-name/image-name

至于它的价值,我认为回购最初是在帐户转换为组织之前推动的。