dockeraccess-denieddockerhub

denied: requested access to the resource is denied when I try to push my Docker image to my DockerHub repository


I have images of a code that makes summaries of document files (pdf, docx ...). I created a Docker image that I wanted to share online on Dockerhub. But strangely I am getting rejected with an access denied.

remplacement@remplacements-MacBook-Pro SugiPerso % docker images
REPOSITORY                       TAG       IMAGE ID       CREATED        SIZE
google-drive-stats               latest    3ee6041a35da   2 hours ago    7.99GB
silverchair/google-drive-stats   latest    3ee6041a35da   2 hours ago    7.99GB
silverchair/summarize            latest    3ee6041a35da   2 hours ago    7.99GB
silverchair/summarizer           latest    3ee6041a35da   2 hours ago    7.99GB
<none>                           <none>    0fd8ba0a03d0   2 days ago     8.77GB
docker/getting-started           latest    289dc403af49   2 months ago   46.5MB
remplacement@remplacements-MacBook-Pro SugiPerso % docker push silverchair/summarize:latest
The push refers to repository [docker.io/silverchair/summarize]
b3e8d2260244: Preparing 
f23ef5b31c37: Preparing 
7b23b0f1ac1c: Preparing 
525da3ba2310: Preparing 
f6f8f61b9120: Preparing 
2546a271e121: Waiting 
646584c2f409: Waiting 
cfb461ef999f: Waiting 
416936900c68: Waiting 
0a39acbc2a98: Waiting 
2b6d33d15c9f: Waiting 
edf70074bd40: Waiting 
denied: requested access to the resource is denied

So, I am silverchair! And I logged in.

(venv) remplacement@remplacements-MacBook-Pro SugiPerso % docker login                                              
Authenticating with existing credentials...
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/

I tried to verify specifying my username, but I can't log in even if I'm sure of my password (it's the one I use for hub.docker.com):

(venv) remplacement@remplacements-MacBook-Pro SugiPerso % docker login -u silverchair
Password: 
Error response from daemon: Get "https://registry-1.docker.io/v2/": unauthorized: incorrect username or password

I tried creating a personnal access token but still got the error:

(venv) remplacement@remplacements-MacBook-Pro SugiPerso % docker login -u sliverchair
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/
(venv) remplacement@remplacements-MacBook-Pro SugiPerso % docker push silverchair/summarize:latest
The push refers to repository [docker.io/silverchair/summarize]
b3e8d2260244: Preparing 
f23ef5b31c37: Preparing 
7b23b0f1ac1c: Preparing 
525da3ba2310: Preparing 
f6f8f61b9120: Preparing 
2546a271e121: Waiting 
646584c2f409: Waiting 
cfb461ef999f: Waiting 
416936900c68: Waiting 
0a39acbc2a98: Waiting 
2b6d33d15c9f: Waiting 
edf70074bd40: Waiting 
denied: requested access to the resource is denied

Solution

  • The error is because you have a typo in your username:

    % docker login -u sliverchair
    Password: 
    Login Succeeded
    
    ...
    
    % docker push silverchair/summarize:latest
    

    You need to tag your image with sliverchair/summarize:latest instead of silverchair/summarize:latest to be able to push to your user's repositories.


    [ Original answer ]

    This shows that you are not logged in with that user:

    (venv) remplacement@remplacements-MacBook-Pro SugiPerso % docker login -u silverchair
    Password: 
    Error response from daemon: Get "https://registry-1.docker.io/v2/": unauthorized: incorrect username or password
    

    Login to Docker Hub (with username silverchair), and in your user settings generate a personal access token. Use this token to login. A PAT is required if you have enabled 2FA. If you cannot login to Hub with that username, double check that you entered the correct username and password.