docker unauthorized: authentication required - upon push with successful login

前端 未结 24 3190
隐瞒了意图╮
隐瞒了意图╮ 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 06:44

    If you running windows 7 docker Registry

    1. Start **Docker Quick Start terminal** run (this terminal enables connection ) Until you pushed images , that will keep token alive .
    2. Login docker login
    3. Make sure you tag the image with username

      docker build -f Dockerfile -t 'username'/imagename

    4. push image

      docker image push username/imagename

    Note: image name all lowercase

    0 讨论(0)
  • 2020-11-28 06:45

    I had the same problem but i fixed it with push with specified url. as: docker login -u https://index.docker.io/v1/

    console output:

    The push refers to a repository [docker.io/<username>/richcity]
    adc9144127c1: Preparing 
    4db5654f7a64: Preparing 
    ce71ae73bc60: Preparing 
    e8e980243ee4: Preparing 
    d773e991f7d2: Preparing 
    bae23f4bbe95: Waiting 
    5f70bf18a086: Waiting 
    3d3e4e34386e: Waiting 
    e72d5d9d5d30: Waiting 
    8d1d75696199: Waiting 
    bdf5b19f60a4: Waiting 
    c8bd8922fbb7: Waiting 
    unauthorized: authentication required
    
    1010deiMac:dockerspace whoami$ docker login -u <username> https://index.docker.io/v1/
    Password: 
    Login Succeeded
    1010deiMac:dockerspace whoami$ docker push <username>/richcity 
    The push refers to a repository [docker.io/<username>/richcity]
    adc9144127c1: Pushed 
    4db5654f7a64: Pushed 
    ce71ae73bc60: Pushed 
    e8e980243ee4: Pushed 
    d773e991f7d2: Pushed 
    bae23f4bbe95: Pushed 
    5f70bf18a086: Pushed 
    3d3e4e34386e: Pushing [=============>                                     ] 45.07 MB/165.4 MB
    e72d5d9d5d30: Pushed 
    8d1d75696199: Pushing [>                                                  ] 1.641 MB/118.1 MB
    bdf5b19f60a4: Pushing [============>                                      ]   142 MB/568.4 MB
    c8bd8922fbb7: Pushing [========================>                          ] 59.44 MB/121.8 MB
    
    0 讨论(0)
  • 2020-11-28 06:45

    Here the solution for my case ( private repos, free account plan)

    https://success.docker.com/Datacenter/Solve/Getting_%22unauthorized%3A_authentication_required%22_when_trying_to_push_image_to_DTR

    The image build name to push has to have the same name of the repos.

    Example: repos on docker hub is: accountName/resposName image build name "accountName/resposName" -> docker build -t accountName/resposName

    then type docker push accountName/resposName:latest

    That's all.

    0 讨论(0)
  • 2020-11-28 06:45

    Make sure your docker repositry name matches your local docker repo name. e.g lets say if you local repo name "kavashgar/nodjsapp"

    then your should also have a repo names "kavashgar" in docker hub

    0 讨论(0)
  • 2020-11-28 06:47

    in your configuration file ~/.docker/config.json add

    {
            "auths": {
                 "https://index.docker.io/v1/": {
                            "auth": "XXXXXXXXXXXXX",
                            "email": "my_email@gmail.com"
                    }
            }
    }
    

    where XXXXX is base64 encoding of your username:password (the : is included) of https://hub.docker.com

    in my case i had the same error with a pull. the problem (under windows) was provoked by double docker running process, so a kill them all and restart one service and it works .

    0 讨论(0)
  • 2020-11-28 06:48

    There has already been good answers but I would like to mention one - You do NOT need to create a repository in advance before pushing it.

    The problem for me was that I didn't set the correct username of the account I logged in to. But once the correct username is set before the image (e.g. YOURNAME/YOURIMAGE) via its tag, you can push it without creating a new repository in advance.

    sudo docker tag IMAGE:VERSION USERNAME/IMAGE:VERSION
    sudo docker push USERNAME/IMAGE:VERSION
    
    0 讨论(0)
提交回复
热议问题