docker unauthorized: authentication required - upon push with successful login

前端 未结 24 3237
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 06:21

While pushing the docker image (after successful login) from my host I am getting \"unauthorized: authentication required\".

Details below.

-bash-4.         


        
相关标签:
24条回答
  • 2020-11-28 07:09

    Same problem here, during pushing image:

    unauthorized: authentication required
    

    What I did:

    docker login --username=yourhubusername --email=youremail@company.com
    

    Which it printed:

    --email is deprecated (but login succeeded still)

    Solution: use the latest login syntax.

    docker login
    

    It will ask for both username and password interactively. Then the image push just works.

    Even after using the new syntax, my ~/.docker/config.json looks like this after logged in:

    {
        "auths": {
            "https://index.docker.io/v1/": {}
        },
        "credsStore": "osxkeychain"
    }
    

    So the credential is in macOS' keychain.

    0 讨论(0)
  • 2020-11-28 07:09

    I tried all the methods I can find online and failed. Then I read this post and get some ideas from @Alex answer. Then I search about ""credsStore": "osxkeychain"" which is used in my config.json. The I follow this link https://docs.docker.com/engine/reference/commandline/login/ to logout and then login again. Finally, I can push my image successfully.

    0 讨论(0)
  • 2020-11-28 07:10

    I was running into a similar issue with a similarly unhelpful error message, but it turned out to be because I was trying to push an image that I had built against a docker-machine managed instance.

    When I logged into the instance itself, did docker login and docker push everything worked fine.

    0 讨论(0)
  • 2020-11-28 07:10

    Even I logged in and checked all the configuration, it still does not work !!!

    It turned out that when I build my docker, I forget to put my username before the repo name

    docker build docker-meteor-build 
    

    (build successfully)

    And then when I pushed to my repository, I used

    docker push myname/docker-meteor-build 
    

    It will show the unauthorized authentication required

    So, solution is then name of build and the push should be exactly the same

    docker build myname/docker-meteor-build 
    docker push myname/docker-meteor-build 
    
    0 讨论(0)
  • 2020-11-28 07:10

    What worked for me was to create a new repository and rename the image with

    $ docker tag image_id myname/server:latest

    0 讨论(0)
  • 2020-11-28 07:11

    I had a similar problem.

    Error response from daemon: Get https://registry-1.docker.io/v2/hadolint/hadolint/manifests/latest: unauthorized: incorrect username or password
    

    I found out out that even if I login successfully with the docker login command, any pull failed. I tried to clean up the ~/.docker/config.json but nothing improved.

    Looking in the config file I've seen that the credentials were not saved there but in a "credsStore": "secretservice". In Linux this happen to be the seahorse or Passwords and Keys tool. I checked there and I cleanup all the docker hub login. After this a new docker login worked as expected.

    0 讨论(0)
提交回复
热议问题