denied: requested access to the resource is denied

2019-01-12 16:41发布

I am following this link to create my first docker Image and it went successfully and now I am trying to push this Image into my docker repository from this link. But whenever I am trying to push this Image into repository , I got this type of error.

denied: requested access to the resource is denied

enter image description here

Could anyone give me some hint towards this problem ? Any help would appreciated.

Note: I have successfully login into docker

30条回答
迷人小祖宗
2楼-- · 2019-01-12 17:24

According to the docs:

You need to include the namespace for Docker Hub to associate it with your account.
The namespace is the same as your Docker Hub account name.
You need to rename the image to YOUR_DOCKERHUB_NAME/docker-whale.

So, this means you have to tag your image before pushing:

docker tag firstimage YOUR_DOCKERHUB_NAME/firstimage

and then you should be able to push it.

docker push YOUR_DOCKERHUB_NAME/firstimage

Update: see also the answer from provided by Dean Wu. Before pushing, remember to log in from the command line to your docker hub account

docker login
查看更多
时光不老,我们不散
3楼-- · 2019-01-12 17:24

docker login from the command prompt did not work. I kept getting "requested access to the resource is denied" when trying to push.

After signing in to the docker for windows app itself, docker push worked just fine. Hope this helps someone.

查看更多
甜甜的少女心
4楼-- · 2019-01-12 17:24

So, incase it is helpful to anyone...
I had this same issue and here is what my issue and the FIX was.

  • I had a computer on my test network named 'galaxy'.
  • I setup docker registry using the following run command:

    sudo docker run -d 
    --restart=always \
    --name registry \
    -v /srv/registry/certs:/certs \
    -v /srv/registry/storage:/var/lib/registry \
    -e REGISTRY_HTTP_ADDR=0.0.0.0:443 \
    -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/galaxy.cert \
    -e REGISTRY_HTTP_TLS_KEY=/certs/galaxy.key \
    -p 443:443 \
    registry:2
    

    Then I was trying to push an image to galaxy from a laptop on the network so I did this:

    docker login galaxy
    

    This would give me an error that would say:

    Login did not succeed, error: Error response from daemon: 
        Get https://galaxy/v2/: x509: certificate signed by unknown authority
    

    Oddly the fix to this issue was to do a login like this:

    docker login galaxy:443
    

    That resulted in a successful login.

    So then I tried to push the image from my laptop to 'galaxy'.
    I had already created a tag for my image that looked like this:

    galaxy/myImage:0.0.1
    

    So I tried to push it doing this:

    docker push galaxy/myImage:0.0.1
    

    To which I got the reply:

    The push refers to repository [docker.io/galaxy/myImage]
    7ab460574f86: Preparing 
    1aecaf56754d: Preparing 
    1df1b5f06ca4: Preparing 
    denied: requested access to the resource is denied
    

    Oddly enough I discovered the fix for this was to first tag the image as follows:

    docker tag myImage:0.0.1 galaxy:443/myImage:0.0.1
    

    ... and then do the push like this:

    docker push galaxy:443/myImage:0.0.1
    

    So for some reason I had to include the port in the tag as a required part of the repository name.



    Hope this helps others.

  • 查看更多
    欢心
    5楼-- · 2019-01-12 17:25

    I had the same issue today. The only thing that worked for me was to explicitly login to "docker.io":

    docker login docker.io

    I tried various other names, and the login would appear to work, but it would later result in a "requested access to the resource is denied" error.

    查看更多
    Ridiculous、
    6楼-- · 2019-01-12 17:26

    Important also to note is that when you tag your image, you tag it using the Namespace and then your repository / mydevrepo. This confused me when following the Docker docs. After that I used:

    docker login
    

    And then I pushed my Image using the 'tagged name'.

    docker push {namespace}/mydevrepo
    
    查看更多
    forever°为你锁心
    7楼-- · 2019-01-12 17:27

    After docker login, you need name your image with prefix.

    e.g. if your username in docker-hub is Shah, the image should be:

    Shah/firstimage
    
    查看更多
    登录 后发表回答