denied: requested access to the resource is denied - Docker - docker

I am new to Docker and trying to push the Docker image to the hub..giving me the below error.
docker container run hellowold
This is v2
docker image tag hellowold:2 prateekaxyz/hellowold:latest
docker login http://hub.docker.com --username=prateek512
Password:
Login Succeeded
docker push prateekaxyz/hellowold:latest
The push refers to a repository [docker.io/prateekaxyz/hellowold]
93351e248e6e: Preparing
298c3bb2664f: Preparing
73046094a9b8: Preparing
denied: requested access to the resource is denied

You need to first tag your image before pushing
docker tag firstimage YOUR_DOCKERHUB_NAME/firstimage
And then you can push it.
docker push YOUR_DOCKERHUB_NAME/firstimage
reference: https://intellipaat.com/community/207/denied-requested-access-to-the-resource-is-denied-docker

you should login first. suppose you have an account in https://hub.docker.com/
as name/password= prateekaxyz/bar.
before push, you should
docker login -u prateekaxyz -p bar
after login success, you can push image to docker hub under your namespace
note that your image should begin with your name, eg prateekaxyz/aa:version

This helped me:
Build the image with the following format:
docker build -t [docker-id]/reponame .
which will by default be given "latest" as tag
and then run:
docker push [docker-id]/reponame:latest

Related

I'm able to push my image to my private Docker registry but the 2nd image push is refused

I am no MacOS installed Docker Desktop.
I have a private registry in Docker Hub.
I have two Dockerfiles in my project, each for one image. Both images are built successfully:
# 1st image
docker build -t myusername/my-app:1.0.3 -f Dockerfile .
# 2nd image
docker build -t myusername/my-proxy:1.0.0 -f proxy/Dockerfile .
On terminal, I firstly login with my docker id myusername:
$ docker login -u myusername docker.io
Password:
Login Succeeded
Then, I push my first image:
$ docker push myusername/my-app:1.0.3
The push refers to repository [docker.io/myusername/my-app]
e632ff00a21f: Layer already exists
...
9578c16f3f7c: Layer already exists
3141322c5cdb: Layer already exists
1.0.3: digest: sha256:43c072e10438c545697c54a76f19a41535a9fb0b7cab2a46b737c5dc497587c0 size: 2422
The push is successful!
Then I try to push my second image:
docker push myusername/my-proxy:1.0.0
The push refers to repository [docker.io/myusername/my-proxy]
c65e7e80b99d: Preparing
abcda12ed2f7: Preparing
...
1222101d19dd: Waiting
...
9e6f810a2aab: Waiting
denied: requested access to the resource is denied
However the 2nd image push to docker registry is denied. Why is that? Where could be wrong for my 2nd image push?

Docker push to private registry error [denied: requested access to the resource is denied]

I login like this:
PS C:\workl> docker login some-registry.io -u username#corp.company.com -p somePasswrod
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded
When I run docker images I get this
CREATED = user/custom-images
tag 1
imageID=34e982156f
I then try to push
docker push user/custom-image:1
The push refers to repository [docker.io/library/custom-image]
50c2af6d2450: Preparing
862d28b9e0d9: Preparing
...
...
878dab86cf0f: Waiting
denied: requested access to the resource is denied
Why? I am adding a tag and have seen others online similar to this but don't seem to be able to find a solution. I can pull just fine.
you need to follow this steps to push to a container :
1/ create a repository inside docker hub https://hub.docker.com/repositories :
just click on create a new repository.
2/ tagging your local image:
docker tag /
the repo_name is the one you created in step 1
3/ commit the image :
docker commit <existing-container> <hub-user>/<repo-name>
4/ and finnaly push it :
docker push <hub-user>/<repo-name>
As #altvits said,
If you want to push to some-registry.io you need to tag it like
docker image tag image:tag some-registry.io/path/image:tag and push it as docker image push some-registry.io/path/image:tag.
Without tagging the push will attempt to push to the default location which in your case is docker.io

docker push give me that error: "an image does not exist locally with the tag"

I'm trying to push an image that is hosted in another project with that command:
docker login [first account with service-account]
docker pull gcr.io/xxx/xxx/xxx:1.0.0
docker login [other service-account]
docker push gcr.io/yyy/yyy/yyy:1.0.0
and that give me that error:
An image does not exist locally with the tag: gcr.io/yyy/yyy/yyy
How I can fix it? I altro tried to tag the image locally but has now worked
You can simply tag your XXX Docker image as YYY, for example:
# Pull image XXX
docker login [first account with service-account]
docker pull gcr.io/xxx/xxx/xxx:1.0.0
# Tag it as YYY
docker tag gcr.io/xxx/xxx/xxx:1.0.0 gcr.io/yyy/yyy/yyy:1.0.0
# Push it on the other account
docker login [other service-account]
docker push gcr.io/yyy/yyy/yyy:1.0.0
Your command fails because Docker does not recognize that gcr.io/yyy/yyy/yyy:1.0.0 is the same as gcr.io/xxx/xxx/xxx:1.0.0 - you must specifically tell-it so by tagging such as above.

denied: requested access to the resource is denied

I wrote gitlab-ci.yml file.
I Login to gitlab registry with this command
docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD $CI_REGISTRY
and in the next step build the docker image
docker build -t $REGISTRY .
But When i push docker image
docker push $REGISTRY
I get this error
denied: requested access to the resource is denied
How can fix this error?
Gitlab is probably not finding any repository of the same name as the registry you're trying to push to.
For example if you do docker push gitlab.helloworld.com/prefix/repo-name, then you need to have a project prefix/repo-name
You can read about more about this issue here
tag the image with {{username}}/{{imagename}}:{{version}}
docker login
docker push {{username}}/{{imagename}}:{{version}}

Creating tag for image pushing to repository

I have created repository in docker cloud andrejvi/andrejvi_repo and would like to place there image I have created.
Image name is dev_centos32
I do push:
sudo docker push andrejvi/dev_centos32
According to my understanding I must create tag for this image. How to do that?
Trying to push:
sudo docker push andrejvi/andrejvi_repo:dev_centos32
got error:
An image does not exist locally with the tag: andrejvi/andrejvi_repo:
UPD
I changed tag, but still can't push to repository
docker tag dev_centos32 andrejvi/andrejvi_repo/dev_centos32
sudo docker push andrejvi/andrejvi_repo/dev_centos32
The push refers to repository [docker.io/andrejvi/andrejvi_repo/dev_centos32]
0afb6e2f03f2: Preparing
d70d6ed6bc21: Preparing
denied: requested access to the resource is denied
UPD
Got error while login
$ sudo docker login andrejvi
Username: andrejvi
Password:
Error response from daemon: Get https://andrejvi/v2/: dial tcp: lookup andrejvi on 127.0.1.1:53: server misbehaving
denied: requested access to the resource is denied
You need to login into Docker Hub/Docker Cloud repository using the command:
docker login
Take a look at Push images to Docker Cloud.
Try:
docker login
docker tag dev_centos32 {docker-hub-username}/andrejvi/andrejvi_repo/dev_centos32
docker image push {docker-hub-username}/andrejvi/andrejvi_repo/dev_centos32

Resources