denied: requested access to the resource is denied

2019-01-12 16:41发布

I am following this link to create my first docker Image and it went successfully and now I am trying to push this Image into my docker repository from this link. But whenever I am trying to push this Image into repository , I got this type of error.

denied: requested access to the resource is denied

enter image description here

Could anyone give me some hint towards this problem ? Any help would appreciated.

Note: I have successfully login into docker

30条回答
神经病院院长
2楼-- · 2019-01-12 17:04

In case anyone else runs into this - the cause, in my case, was that I was using the (deprecated) docker compose approach to push images. Switching to the expected docker push resolved the issue for me.

查看更多
贼婆χ
3楼-- · 2019-01-12 17:07

The way docker handles user IDs and repositories may be a bit confusing. Let's say you create a user account xyz on docker hub. The new account automatically establishes a namespace xyz. Then you create a repository called myrepo. The repository name will actually be xyz/myrepo.

To push an image you should do:

docker push docker.io/xyz/myrepo

You can add ":latest" or a different tag if necessary.

If you get the requested access to the resource is denied error message:

  1. Go to https://hub.docker.com/ and sign in as xyz.
  2. Click on your repository xyz/myrepo.
  3. Click on Collaborators.
  4. Add xyz as a collaborator.
查看更多
一夜七次
4楼-- · 2019-01-12 17:08

all previous answer were correct, I wanna just add an information I saw was not mentioned;

If the project is a private project to correctly push the image have to be configured a personal access token or deploy token with read_registry key enabled.

source: https://gitlab.com/help/user/project/container_registry#using-with-private-projects

hope this is helpful (also if the question is posted so far in the time)

查看更多
相关推荐>>
5楼-- · 2019-01-12 17:09

rename your image to username/image-name docker tag your-current-image/current-image dockerhub-username/some-name:your-tag(example: latest)

查看更多
相关推荐>>
6楼-- · 2019-01-12 17:09

In my case sudo -E failed with this message. The resolution was to provide access do docker without sudo (create a group docker, add the (Jenkins) user to the group, set the group on /var/run/docker.sock). Now docker push does not need sudo, and it works.

查看更多
够拽才男人
7楼-- · 2019-01-12 17:10

If it still fails after docker login, make sure the repository you're trying to push to was created in the first place.

查看更多
登录 后发表回答