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
Could anyone give me some hint towards this problem ? Any help would appreciated.
Note: I have successfully login into docker
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 expecteddocker push
resolved the issue for me.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 bexyz/myrepo
.To push an image you should do:
You can add ":latest" or a different tag if necessary.
If you get the
requested access to the resource is denied
error message: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)
rename your image to username/image-name docker tag your-current-image/current-image dockerhub-username/some-name:your-tag(example: latest)
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.If it still fails after
docker login
, make sure the repository you're trying to push to was created in the first place.