I can't push my local image to Docker hub. I checked every topics in here but still couldn't solve it.
My local image is like below;
[root#DOCKER2Demo]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
companyrepo123/man-demo latest b86sbfd26 41 minutes ago 5.31GB
So I want to push this image to the "companyrepo123/man-demo:latest" repository.
So I login successfully with "docker login" and run the command below
docker push companyrepo123/man-demo:latest
But gives the error below;
The push refers to repository [docker.io/companyrepo123/man-demo]
82bb2b81506d: Preparing
0ae79b7db02c: Preparing
df9824e71502: Preparing
d384c5326457: Preparing
da1504cd9d9b: Preparing
976e766378b6: Waiting
8154f91c38f9: Waiting
a74cf09880c3: Waiting
1c0efef42405: Waiting
1417e6a7c4fd: Waiting
79ac04ef09ff: Waiting
77b174a6a187: Waiting
denied: requested access to the resource is denied
I already login. Tried to logout and login and but still same.
Please noticed that my username is not "companyrepo123". This is our company's repository, my username to login Docker hub is "yatta".
How can I push that image?
Regards.
You need to push to a repository under your namespace in Docker Hub, where the first part of that path is your username or organization. So myrepo123 would be your username.
Next, you'll want to create the repository, myrepo123/man-demo on Docker Hub (from the web interface), and if this is under an organization, make sure your user has access to push to that repo within the organization.
If you've done that, then make sure you have logged into Docker Hub, with the correct username, using:
docker login
If you have enabled 2fa on Hub, the password for this is an access token you generate from the web page.
Related
I'm trying to push an image to gitlab registry.
I've done it many times, so I wonder why I get this error.
I build the image with latest tag:
Successfully tagged registry.gitlab.com/mycompany/rgpd_api:latest
Then I login and I push:
docker login registry.gitlab.com -u gitlab+deploy-token-91931
docker push registry.gitlab.com/mycompany/rgpd_api:latest
But I get:
The push refers to repository [registry.gitlab.com/mycompany/rgpd_api]
be679cc302b9: Preparing
denied: requested access to the resource is denied
I gave gitlab+deploy-token-91931 token both read_repository and read_registry rights.
My repo is:
https://gitlab.com/mycompany/rgpd_api
I checked with docs page: https://docs.gitlab.com/ee/user/project/container_registry.html
But when I do it through Gitlab CI, with gitlab-ci-token
I can push it normally.
I also tried to regenerate a new token, but still same issue.
How can I fix it ?
I've stumbled upon this question as well and it turns out that
Group level Deploy tokens can be used to push images to group level container registry similarly to a PAT token with API access or other applicable scopes.
The image must to be tagged with the tag that matches an existing project within the group.
Any image tagged differently will be rejected with the denied: requested access to the resource is denied error message.
So, with the setup below:
GitLab group called mytest
Project within that group called hello-world
Docker image tagged as registry.gitlab.com/mytest/hello-world
Deploy token created for an entire group
Docker daemon authorized to push to that registry by cat "<deploy_token>" | docker login -u "<token_username>" --password-stdin registry.gitlab.com
You will get the following results:
Successful push for docker push registry.gitlab.com/mytest/hello-world because such project exists within the group
denied: requested access to the resource is denied if you try to push an image tagged with the name of the project that does not exist in the group like docker push registry.gitlab.com/mytest/no-project
So, again, image must be tagged to match an existing path within te group, like an existing project within the group or a subgroup.
My error was to use a deploy token to push a image to a registry.
A deploy token can be used to pull an image, but not push it.
So, instead, you can generate a Personal Access Token. You should add at least permissions:
read_registry, write_registry
Make sure you have proper configuration in settings.
Go to Settings of project, then "Visibility, project features, permissions" and check "Container registry : Every project can have its own space to store its Docker images" (for members only or for everyone, up to you). Otherwise, the push and pull will be denied.
This happened to me and that's how I solved it.
you can make docker logout your registry and login again.
It's recreate your token.
this work in my case.
I have an internal company docker repository.
When I was added to it, I received a repository url of the format:
https://docker.mycompany.com/repositories/myusername/myrepository
Ok. great.
I've created a Dockerfile and I have built the docker image.
docker build -t business-services:latest .
Everything works.
I do a
docker images
and I see:
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
business-services latest aaaaaaaaaaaa 3 hours ago 120MB
openjdk 8-jdk-alpine bbbbbbbbbbbb 2 weeks ago 103MB
Great!
Now I'm trying to push "business-services:latest" to:
https://docker.mycompany.com/repositories/myusername/myrepository
...
Here is where things go awry.
First, before you ask, YES, I did a login.
docker login https://docker.mycompany.com/repositories/myusername/myrepository
Username: myusername
Password:
Login Succeeded
The issue comes when I try to "tag" it and then push it.
It looks like the tag name is some kind of mixture of concerns....between the remote docker repository and the image:release. :( Boo.
If I tag it this way:
docker tag business-services:latest docker.mycompany.com/repositories/myuserna/business-services:latest
and i do docker images I see this:
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
business-services latest aaaaaaaaaaaa 3 hours ago 120MB
docker.mycompany.com/myusername/myrepository/business-services latest aaaaaaaaaaaa 3 hours ago 120MB
openjdk 8-jdk-alpine 04060a9dfc39 2 weeks ago 103MB
and then try to push it like this
docker push docker.mycompany.com/myusername/myrepository/business-services
The push refers to repository [docker.mycompany.com/myusername/myrepository/business-services]
denied: requested access to the resource is denied
so its confusing the repository name
I did it this way too, just to make sure
docker push docker.mycompany.com/myusername/myrepository/business-services:latest
The push refers to repository [docker.mycompany.com/myusername/myrepository/business-services]
denied: requested access to the resource is denied
same error :(
Then I tried this:
docker tag business-services:latest docker.mycompany.com/business-services:latest
docker push docker.mycompany.com/business-services:latest
The push refers to repository [docker.mycompany.com/business-services]
denied: requested access to the resource is denied
That doesn't work because i'm not giving myuser/myrepository in the value.
Gaaaaaaaaaaa
This "mixture" of the remote url and the container name is driving me nuts.
At some point of trying to figure out the string voodoo, I got this error:
The push refers to a repository
An image does not exist locally with the tag:
What is the magic sauce for pushing to a url name like
docker.mycompany.com/myusername/myrepository
and who came up with this mix the target repository WITH the imagename voodoo?
Or am I completely off-base for how to push something to a internal company docker repository
RESEARCH stuff I found below:
https://docs.docker.com/engine/reference/commandline/push/#examples
Now, push the image to the registry using the image ID. In this
example the registry is on host named registry-host and listening on
port 5000. To do this, tag the image with the host name or IP address,
and the port of the registry:
$ docker tag rhel-httpd registry-host:5000/myadmin/rhel-httpd
$ docker push registry-host:5000/myadmin/rhel-httpd
Yes, I have researched this, thus how I got this far with my journey.
docker --version
Docker version 18.09.0, build 4d60db4
Thanks !!
Append
I followed these instructions:
http://karlcode.owtelse.com/blog/2017/01/25/push-a-docker-image-to-personal-repository/
under the "Push to your private repository" area.
Same error. can't find the URL
docker tag business-services docker.mycompany.com/myusername/myrepository/business-services:latest
docker push docker.mycompany.com/myusername/myrepository/business-services:latest
The push refers to repository [docker.mycompany.com/myusername/myrepository/business-services]
denied: requested access to the resource is denied
Do you have any other images from this repository? check the tags and make yours similar. Anyway, it is your company internals, it could be configured in different ways and better to ask internal guys who support this repo. Also, ask them to check your permissions.
for example, in my case works something like artifactory.company.com:10001/myusername/virtualreponame/imagename:latest
but in your case, it could be completely differ
So I finally got this to work
docker tag business-services
docker.mycompany.com/myusername/business-services:latest
docker push docker.mycompany.com/myusername/business-services:latest
It looks like the "short name" (in this case "business-services")... ~becomes~ the repository name. Or something like that.
and the repository on the docker trusted repository shows up as:
https://docker.mycompany.com/repositories/myusername/business-services
Anyways. It looks silly now. I hope that helps someone in the future.
No matter what I do I can't push images to google repository. I followed this guide and I do these commands directly from the google cloud shell
docker build -t eu.gcr.io/[project-id]/[imagename]:[tag] ~/[folder]
docker tag eu.gcr.io/[project-id]/[imagename]:[tag] eu.gcr.io/[project-id]/[imagename]:[tag]
docker push eu.gcr.io/[project-id]/[imagename]:[tag]
I get this output when pushing
4d1ea31bd998: Preparing
03b6a2b0817c: Preparing
104044bed4c7: Preparing
2222fefcbbfc: Preparing
75166708bd17: Preparing
5eefc1b802bb: Waiting
5c33df241050: Waiting
ffc4c11463ee: Waiting
denied: Unable to access the repository, please check that you have permission to access it.
I've search for this online but everyone seems to have authentication issues. Since I can't execute this neither from my local machine or the google cloud shell I don't think there's a problem there since when I'm on the shell I'm using the owner account [owner]#[project-id]. I have billing and Container Registry API active
From my understanding pushing should create a bucket for this but I even tried creating a bucket but I have no idea if and how to configure it to be used for image repository. I have billing and Container Registry API activated
You probably did not authenticate with the registry. Please try to login before pushing. Just type in the console and enter your credentials:
docker login eu.gcr.io
I try to push an image in my public docker repository, but after some minutes I have this problem:
and during pushing, the following occurs many times (when retrying):
My version of docker is the following:
How to solve this problem ?
When I push an image to ECR, an EOF error occured.
The reason is remote repository[jdk-8-newrelic] does not exist.
After creating the repository, PUSH succeeded.
I got this error when my image name was incorrectly formatted.
I was trying to push an image called registry-url/my-repository/my-image-name:tag
This is wrong; I need a repository per image name. registry-url/my-image-name:tag worked, once I created the repository named my-image-name.
This was on ECR.
I was missing this policy AmazonEc2COntainerRegistryFullAccess in permission of the iam user
In case you are trying to push into the AWS ECR, this happens when the connection to the repository has failed. This could be either because
the repository doesn't exist
the repository exists but in a different region
the AWS credentials are incorrect.
the AWS credentials have just been corrected
Once you have the repository created in the correct region and the AWS cli Credentials are corrected, ensure that you run the AWS docker login command once again and repeat the tag and push steps.
I have met this issue nowadays when I am pushing an image to a private registry. And I checked out the Docker log and found that there was something unexpected about the proxy but I did not have to push to my private through the proxy. So I added my registry address to the Docker proxy whitelist to skip the proxy, and it worked. I wish it helps!
I had a similar problem pushing to a private docker repository, and the problem was wrong credentials.
Try to read the logs:
Get-EventLog -LogName Application -Source Docker -After (Get-Date).AddMinutes(-5) | Sort-Object Time
ref: https://learn.microsoft.com/en-us/virtualization/windowscontainers/troubleshooting#finding-logs
In my case, I had saved AWS credentials from another account where I did not have full access anymore. Check your C:\Users\YourUserName.aws\credentials if you are on Win.
Yes, You need to create a repository in AWS ECR.
PFB for AWS AC.
docker push aws-ac-id.dkr.ecr.us-west-2.amazonaws.com/build-agent:latest
Here I have created a build-agent ECR repository and the above command got successful.
Don't forget to run the below command.
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin aws-ac-id.dkr.ecr.us-west-2.amazonaws.com
This error occurs when trying to push an image to the public repository on Docker Hub. There have been no issues with other registries I have tried.
I have looked at numerous sites, blogs including StackOverflow and there is still no clear answer.
You can try to replicate this issue as follows.
As shown in the screenshot above, I have an image aspc-mvc-app on local docker host. As shown, it has 3 tags - 1.0.5, 1.0.5.latest and latest.
Assume that we are trying to push using an account name of janedoe at Docker Hub
Per documentation on Docker.io and numerous other sites, there are 3 steps to pushing.
(1) Login
docker login "index.docker.io" -u janedoe -p <password>
--> I get Login Succeeded which is good!
(2) Add one or more tags
Of the 3 tags, let's just tag the latest.
docker tag janedoe/aspc-mvc-app:latest janedoe/aspc-mvc-app
--> The prompt returns with no error. So far so good.
(3) Push
docker push janedoe/aspc-mvc-app
--> This is where the error occurs.
As shown on the screenshot below, initial checks seem to occur fine until you get the error denied: requested access to the resource is denied
At step (2), I have tried numerous other formats including the following.
docker tag janedoe/aspc-mvc-app:latest janedoe/aspc-mvc-app:latest
docker tag janedoe/aspc-mvc-app janedoe/aspc-mvc-app:latest
docker tag aspc-mvc-app:latest janedoe/aspc-mvc-app
docker tag aspc-mvc-app janedoe/aspc-mvc-app:latest
docker tag 306a8fd79d88 janedoe/aspc-mvc-app
docker tag 306a8fd79d88 janedoe/aspc-mvc-app:latest
All fail with the same error.
As a comparison, with the same exact image, I had no problem pushing to Azure Container Registry.
Since Docker Hub is so popular, can anyone shed light on what the mystery is, or if there is a detailed documentation anywhere?
Updated 5/9/2017
I am fairly up-to-date on docker cli and server versions. Right now, my cli is 17.05.0-ce-rc1 and server is 17.04.0-ce as shown below.
The solution is simply to change the way of logging in at step (1).
docker login -u janedoe -p <password>
Everything else can stay the way described above. The image was successfully pushed to Docker Hub!
First login by typing sudo docker login in the terminal. Enter username and password
Visit your docker account and create a new repository. In my case I created a repository crabigator1900/dockerhub
Say you have a docker image with repository name:crabigator/django and tag:latest.
In that case you will need to tag this image with a label of your wish. I decided to tag it with the label:myfirstimagepush. You tag the image by typing the command
sudo docker tag crabigator/django:latest crabigator1900/dockerhub:firstimagepush
Finally push the image to your repo using the command
sudo docker push crabigator1900/dockerhub:firstimagepush
That's all there is to it.
I too had the same issue, but after trying some combinations this worked.
Whenever you push - that refers to docker.io/ followed by registry path.
In my case my username is rushmith and I created a sample repository called docker under rushmith.
My link is : "hub.docker.com/r/rushmith/docker/"
Now I created a tag to my image that I want to push as: rushmith/docker
And It worked successfully.
$ docker login -u rushmith
(Give the password then type as below)
$ docker push rushmith/docker:latest
Output:
The push refers to a repository [docker.io/rushmith/docker]
7fbb0e1e64cb: Pushed
33f1a94ed7fc: Pushed
b27287a6dbce: Pushed
47c2386f248c: Pushed
2be95f0d8a0c: Pushed
2df9b8def18a: Pushed
latest: digest:
sha256:4d749d86b4a2d9304a50df474f6236140dc2d169b9aabc354cdbc6ac107390f2 size: 1569
I hope this late solution might help someone.
The reason of this error message was you haven't named your images properly.
Let say your account name on docker.io was your-name then your new repo name is going to be your-name/your-new-image-name.
In order to push your image, first you have to tag (name) your local images as:
docker tag local-image[:tag-name] your-name/your-new-image-name[:tag-name]
Things in the brackets is optional. You may want to check the result with docker image ls. Then let push your image to your docker repo:
docker push your-name/your-new-image-name[:tag-name]
Done! Your image was pushed to docker repos.
You can follow the following steps:
Step 1: docker login -u <username> -p <password>
A message with "Login Succeeded" will appear, confirming your successful login.
Step 2:
Now in order to push the image just make sure the path which you are using must have your username included in the tag.
e.g: Suppose link is: "hub.docker.com/u/xyz/"
Create a tag to image as docker push xyz/docker:latest.
If you already have some different tag change it using command
docker tag <old tag> <new tag>
Hope this helps.
after 1 hour's struggling with different ways mentioned above,
I reinstalled the neweast version of Docker Desktop app in my mbp, then it is solved.
the neweast version is 20.10.2
and the old version is 17.x, which was installed 5 years ago.
First you need to ensure you have logged into your account
You need to create a repository, below is the command to create a repository -
docker tag local-image:tagname YOUR-ACCOUNT-NAME/tagname
docker push YOUR-ACCOUNT-NAME/tagname
Create a repository from a website.
It possible that you don't have a permission for creating repository.
docker push does not create a repo name so if not present it says access not available
This worked for me.
> docker login -u janedoe
Password:
Login Succeeded
> docker tag myapp:0.0.1 janedoe/myflinkapp:0.0.1
> docker push janedoe/myapp:0.0.1
The push refers to repository [docker.io/janedoe/myapp]
b763be657a2c: Pushed
e534dae385a8: Pushed
5af3d5d57035: Pushed
0e44828b51e2: Pushed
fdd771f27095: Pushed
ef9a7b8862f4: Pushed
a1f2f42922b1: Pushed
4762552ad7d8: Pushed
0.0.1: digest: sha256:0069ee2c39b422e64f0493d2b2e9cbe7736a size: 2154
In my case, I was facing this issue even after logging into Docker registry successfully.
So, I tried running the docker push as sudo and it worked.
Make sure you follow these steps:
Run docker login
After logging in successfully, run the docker push command
If the push failed, run this: sudo docker push repoName:tagName
If you're using 2FA and run
docker login -u <your_docker_user_name>
you will get Login successful but you won't be able to push.
This is because you're using 2FA which requires one-time password to login into your account.
To be able to push with 2FA enabled you need to use an access token. To generate one go to Account settings/Security on Docker Hub website and click New Access Token. As of Access Permissions preferably choose Read & Write - this is the entry level for being able to push. Only generate Read, Write, Delete token if you really need it!
You'll be prompted with instructions on what to do next. Just to keep the answer full, you'll have to run
docker login -u <you_docker_username>
and when prompted for Password paste your Personal Access Token.
IMPORTANT: save your Personal Access Token in a password manager and never share with anyone and never push to github or add to your source code. NEVER! Please.
Now, when you run docker push <your_docker_username>/<your_docker_repo_name>:<tag_of_your_image> you should be able to push the image to the Docker Hub.
I have the same problem and it was solved by running the push command with sudo. I think it is only a privilege problem.
sudo docker push janedoe/aspc-mvc-app