我正在按照这个链接创建我的第一个docker映像,它成功了,现在我试图从这个链接将这个映像推到我的docker存储库中。但是每当我试图将这个映像推入存储库时,我就会得到这种类型的错误。
denied: requested access to the resource is denied
注:我已成功登录docker
我正在按照这个链接创建我的第一个docker映像,它成功了,现在我试图从这个链接将这个映像推到我的docker存储库中。但是每当我试图将这个映像推入存储库时,我就会得到这种类型的错误。
denied: requested access to the resource is denied
注:我已成功登录docker
当前回答
如果您已经登录,如果您仍然得到错误。请按照步骤操作,
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
其他回答
我知道这个问题已经有很多答案了,但没有一个对我有帮助。
我观察到的是,构建映像非常快,并将其推到docker。IO导致错误:
denied: requested access to the resource is denied
我还注意到做一个
docker image ls
显示我的图像的最新构建是几天前的。
我必须做一个
docker container prune
来摆脱停止的容器,和一个
docker image prune -a
为了摆脱旧的形象。 然后我就可以成功地建立和推广我的形象。
'denied:对资源的请求访问被拒绝'不是来自docker。我是本地码头工人。有趣的是,它在构建过程中并没有失败。
您可能需要在docker push之前将docker repo切换为private。
感谢Dean Wu提供的答案和ses的评论,在推送之前,请记得注销,然后从命令行登录到您的docker hub帐户
# you may need log out first `docker logout` ref. https://stackoverflow.com/a/53835882/248616
docker login
根据文件:
You need to include the namespace for Docker Hub to associate it with your account.
The namespace is the same as your Docker Hub account name.
You need to rename the image to YOUR_DOCKERHUB_NAME/docker-whale.
所以,这意味着你必须在推送之前标记你的图像:
docker tag firstimage YOUR_DOCKERHUB_NAME/firstimage
然后你就可以推它了。
docker push YOUR_DOCKERHUB_NAME/firstimage
在尝试了每个高分解决方案后,我仍然没有运气。
直到我改变了我的重点和搜索关键字,包括我的凭证助手通行证。
如果您遇到类似的情况(使用任何类型的docker-credential-helpers,并遵循一般指导原则进行设置),请尝试检查步骤,看看是否遗漏了任何内容。
例如,我使用pass作为docker的凭据库,当我只是按照顶部搜索结果设置pass时,错过了为专用的pass-name docker- credial -helpers/docker-pass- initialization -check插入我的dockerhub帐户密码的步骤。
在发出以下命令后,docker push终于对我发了慈悲。
pass insert docker-credential-helpers/docker-pass-initialized-check
更多细节请看这个答案。
使用以下命令:
$ docker login
<enter user name and password for Docker Hub Repository>
$ docker tag first-image {docker-hub-username}/{default-repo-folder-name}:first-image
$ docker push {docker-hub-username}/{default-repo-folder-name}:first-image
例如,我有像manjeet86/docker-repo这样的公共存储库,所以命令将是:
$ docker tag first-image manjeet86/docker-repo:first-image
$ docker push manjeet86/docker-repo:first-image
你看:而不是/这就是窍门。这对我很管用。我不知道它是否让你用/来代替:,但这可能是出于其他目的。
https://docs.docker.com/engine/reference/commandline/tag/#examples
我得到了同样的错误。不幸的是,这个错误是由于在docker push之前使用sudo造成的。此外,您可能需要从dockerhub中删除存储库,因为您可以拥有的repo数量是有限的。并且,请尝试docker注销,然后docker登录