docker unauthorized: authentication required - upon push with successful login

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

    The problem newbies face is that we tend to treat docker hub repository just like a maven repository and think that it might contain many a different files, folders and other contents.

    A docker repository on the other hand is just a single image, it does not contain anything else. It can hold different versions of the same image, but its going to contain just one image.

    So, name your repository on docker hub the same name as the image you want to push into it, and use your dockerhub username as prefix. For eg, if your username is myusername and your image name is docker-whale , make sure to name your dockerhub repository as docker-whale and use the below commands to tag and push your image to repository:

    docker logout                                   # to make sure you're logged out and not cause any clashes
    docker tag  myusername/docker-whale    # use :1.0.0 for specific version, default is 'latest'
    docker login --username=myusername              # use the username/pwd to login to docker hub
    docker push myusername/docker-whale             # use :1.0.0 for pushing specific version, default is 'latest'
    

提交回复
热议问题