problem solved, thank you
Hello everyone.
Now I have the same problem, after trying to push my image, I see the error:
denied: requested access to the resource is denied
I checked suggestions above to solve this problem, but nothing helps, I do the same as it is mentioned above.
My system is Ubuntu 22.04.3 LTS
The steps I did:
- I created an account at docker hub. And created a repository. And I got the docker command to push
docker push denys83/getting-started:tagname
- I came to console and made a login to docker:
sudo docker login
I couldnât login with just âdocker loginâ, it was an error. So I googled that I need to add âsudoâ and it worked.
3. I started build process of the image:
docker build -t denys83/getting-started:version_01 .
I got my image created
4. I tried to push my image to docker hub:
docker push denys83/getting-started:version_01
What can be the problem or what I did wrong?
The problem is solved.
For those who will stuck with the same problem - To get connection with the docker hub, you will firstly need to generate gpg-id public key, and init pass with this key.
Here is docs on how to do this:
in my case, after spending some time investigating, the issue was with the keychain of mac OS for some reason.
so depending on where the password gets stored (refer to this link for reference) , the config file ~/.docker/config.json
can either look like one of the following:
1. If no keychain used , the password will be stored directly in the file ,
example :
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "base64-encode-of-your-credentials"
}
}
}
2. If a key chain is used then the credentials will not be saved in the file and the credsStore will be mentioned in the file ,so will look something like this :
{
"credsStore" : "osxkeychain",
"auths" : {
"https://index.docker.io/v1/" : {
}
}
}
In my case a cred store was being used and apparently there was something wrong with even it when I docker logout
and docker login
again , in which case 2 different solutions have worked for me:
1. Edit the config file and remove the "credsStore" : "osxkeychain"
element and also add the âauthâ element along with the base64 encoding of your creds from the format username:password
, this way you are telling docker I am directly using the credentials from the file and no key store used , of course this method is less secure.
2. I opened the keychain access in my mac ( by searching for keychain access in the spotlight search) , then inside there I searcher for docker to see the credentials , upon opening it and ticking show password I found that the value was empty (not sure why) , so I manually put it there and clicked saved changes .
and voila after applying any of above solutions , the docker push command worked normally.
Setting the tag fixed my issue.
I also faced same problem.
This is how i created the image -
docker build -t first-test:1.0 .
docker push first-test:1.0
The push refers to repository [docker.io/library/first-test]
9318d63e4ed3: Preparing
2769ba6ae003: Preparing
02ce310654d0: Preparing
42d3f8788282: Preparing
denied: requested access to the resource is denied
Do I need to create a image in such format username/image:tag ?
but if I created the image in right way then why its failing ?
Yes
You probably forgot to log in
Worked for me. Thanks for the suggestion
I was also getting the same error, then I checked for the rights provided to the Personal Access Token created on Docker Hub account, I edited it to Read, Write & Delete.
The issue got resolved.
You have to provide proper tagging to the image:
docker tag projetofinal2_web yourusername/projetofinal2_web
docker push yourusername/projetofinal2_web
I kept encountering access denied errors when trying to push my Docker image to Docker Hub. After many attempts with different solutions, I discovered that switching to the root user (sudo su) let me push the image successfully.
I was getting this same issue.
Always used sudo for docker commands but even after successful login it wasnât allowing me to push my code that is until I added a tag.
Adding a tag is sort of necessary now. previously if you didnât specify a tag it would automatically put the âlatestâ tag on it.
This post was translated by a moderator using Google Translate
Hi, I had the same problem and after trying all the solutions on the forums, I just thought of doing the push from superuser, so my solution was:
sudo su
docker push name_images
Hope it helps.
The official language of the forum is English. Please, edit your post and translate it to English. Non-English posts could be deleted to avoid spams. Thank you.
Update: I translated it this time
Uau!
This explanation is killer.
Build creating the tag, accessing it and pushing it.
Thanks man!
Hi everyone. Not sure if itâs been already said, but in my case it helped doing a docker logout from the repo before issuing a new docker login.