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

denied: requested access to the resource is denied

注:我已成功登录docker


当前回答

Docker登录参数在~/. Docker /config。Json应该正确设置(这是在登录后自动完成)

1)不传递SERVER参数登录:

$ echo "<password>" | docker login -u foo --password-stdin

成功登录后,在~/.docker/config中会出现如下结果。Json和push image成功。

***
"https://index.docker.io/v1/": {
    "auth": "YWNhcm***"
}
***

2)登录时传递SERVER参数index.docker.io

$ echo "<password>" | docker login index.docker.io -u foo --password-stdin

成功登录后,在~/.docker/config中会出现如下结果。Json和push image失败。

***
"index.docker.io": {
    "auth": "YWNhcm***"
}
***

其他回答

如果在使用Azure容器注册表时遇到此问题,可以先登录到注册表来解决。

docker login yourregistry.azurecr.io

然后标记您的映像以匹配注册表的主机名。

docker image tag yourimagename:[version] yourregistry.azurecr.io/yourimagename:[version]

最后按一下。

docker push yourregistry.azurecr.io/yourimagename:[version]

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

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

这可能是特定于DigitalOceans容器注册表,但它可能有帮助:

在我的例子中,我的管道在docker推送之后触发了一个清理作业(doctl注册表垃圾收集启动),这将注册表置于只读模式(参见doc)。因此,在清理作业处于活动状态时的下一个推送将被拒绝:对资源的请求访问将被拒绝。

如果doctl注册表垃圾收集get-active返回404,则作业完成,docker推送将成功完成。

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

# Login to docker hub account 
docker login 

# tag image 
docker tag nginx xyz/nginx

# push image
docker push xyz/nginx

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