Why is my Docker image not being pushed to Docker Hub? - docker

I have a Docker image that I'd like to push to Docker Hub:
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
mattthomson/hadoop-java8 0.1 d9926f422c14 11 days ago 857.9 MB
```
I've run docker login, logged in as mattthomson, and run docker push mattthomson/hadoop-java8:0.1. This takes a while, showing a progress bar of the upload.
However, it seems not to have worked. If I run docker pull mattthomson/hadoop-java8:0.1 from another computer, I get "Tag 0.1 not found in repository mattthomson/hadoop-java8". The images doesn't show up here, either.
What am I doing wrong?

I had to confirm my email address so my repositories show up on docker hub. Simple but didn't notice at first.

I experienced this when my Docker Hub organisation had reached its limit on the number of private repositories I was allowed to create (and I also got an email from Docker Hub about reaching this limit).
To solve the problem I upgraded my Docker Hub subscription to allow more repositories.
It would be nice if the error message from Docker Hub contained some hint to the cause.

I retried a number of times before this went through successfully. I was misled by the fact that the upload was failing partway through, without displaying an error message, just a timestamp. The error code was non-zero.

Related

Docker Desktop Push of Image to Private Repo Fails

I have Docker Desktop, but create my images on a Linux ARM64 machine, not the MacBook with the Docker Desktop application on it. I want to push these ARM64 images from the Linux host itself, but have run into the following problem:
When I push my image to my Docker Hub private repo with the command:
docker push myDockerHubUserName/myPrivateRepoName:tagOfImage
It fails with the error:
invalid reference format
The form of the command Docker has provided in my Docker account is described as:
Docker commands
To push a new tag to this repository,
docker push myDockerHubUserName/myPrivateRepoName:tagname
I've double-checked the values and syntax: ALL are 100% correct. But the push nonetheless fails.
How is this broken?!?!
Intro:
The error:
invalid reference format
is actually a red herring that will mislead you into believing that there is a syntax error in your push command when there isn't and you'll waste your time...
Problem:
Feel free to jump to the "SOLUTION" section below if you don't care how the commands fails and just want to know how to make it execute successfully ;-)
The instructions for pushing the image that Docker provides in their user's accounts have some large & material gaps. You will waste your time- a fair bit of it- if you do not have the following context:
You must login to your Docker Account before trying to push anything to it:
docker login -u yourDockerAccountUsername
The command Docker Hub gives you implies that the image you're trying to push was already TAGGED with the private repo as part of the tag itself.
It just appears to be a string comprised of (3) parts:
<dockerUserName>/<privateRepoName>:<tagname>It is NOT. You CANNOT merely concatenate
"myDockerHubUserName/myPrivateRepoName"
with
"tagname"
delimited with a colon! "myDockerHubUserName/myPrivateRepoName" must itself be part of the tag or the command will fail!!!
This "help" from Docker I found to be worse than giving no "help" at all because it served to create undue confusion. This is absolutely fundamental stuff and deserves better treatment.
Solution:
Login to your Docker Account:
docker login -u yourDockerAccountUsername
Get the Image ID for the Image that you want to push:
docker image ls
Tag the image with your Docker Hub User ID, Docker Hub Repo Name AND Image Name:
docker tag ae1b95b73ef7 myDockerHubUserName/myPrivateRepoName:myImageName
Push the Image:
docker push myDockerHubUserName/myPrivateRepoName:myImageName
Note the COLON separating the repo & image name: I've seen this described as a forward slash in other answers but I found a colon is required for the command to succeed.
Conclusion:
This was a big and unnecessary time-waster that sent me down the rabbit hole. Hopefully this answer will save others wasted time.
Attribution:
This answer was actually pieced together from several different Stack questions which got me across the finish line. Kudos to Abhishek Dasgupta for the general procedure & kudos to Илья Хоришко for the form of the tag which worked in the end. You folks are stars!

Docker-compose check latest version of an image

Is there a way to check if docker-compose is running the latest version of an image? I know that I can run docker-compose pull to get the latest version, but what happens if I run the pull command and docker-compose already has the newest image? Does the pull request count against my Docker Hub pull request limit?
My end goal is to check for a new image every 24 hours without using Watchtower.
When you do a docker pull against the ":latest" tag of an image, docker will only pull that image if this version of the image is not on your local repository/computer. Works lit git pull, basically. Docker-compose does a simple, classic docker pull, so same mechanic.
You can find a way to find your docker pull limit rate, and your number of remaining pulls in at this link
You can try consulting your remaining pulls, then lauching docker pull <some image>:latest, consulting your remaining pulls again (it'll show the same -1) and doing the same pull again. Pull checks the image version, does not detect changes, does not pull, your remaining pulls number stay the same.
Anyway, you get 100 pulls/6 hours if you are an anonymous user and 200 pulls/6 hours if you are an authentified user. For your use case, you would be okay even if you were pulling the image every day.

docker push to a my-company docker repository

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.

Docker fails on changed GCP virtual machine?

I have a problem with Docker that seems to happen when I change the machine type of a Google Compute Platform VM instance. Images that were fine fail to run, fail to delete, and fail to pull, all with various obscure messages about missing keys (this on Linux), duplicate or missing layers, and others I don't recall.
The errors don't always happen. One that occurred just now, with an image that ran a couple hundred times yesterday on the same setup, though before a restart, was:
$ docker run --rm -it mbloore/model:conda4.3.1-aq0.1.9
docker: Error response from daemon: layer does not exist.
$ docker pull mbloore/model:conda4.3.1-aq0.1.9
conda4.3.1-aq0.1.9: Pulling from mbloore/model
Digest: sha256:4d203b18fd57f9d867086cc0c97476750b42a86f32d8a9f55976afa59e699b28
Status: Image is up to date for mbloore/model:conda4.3.1-aq0.1.9
$ docker rmi mbloore/model:conda4.3.1-aq0.1.9
Error response from daemon: unrecognized image ID sha256:8315bb7add4fea22d760097bc377dbc6d9f5572bd71e98911e8080924724554e
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
$
So it thinks it has no images, but the Docker folders are full of files, and it does know some hashes. It looks like some index has been damaged.
I restarted that instance, and then Docker seemed to be normal again without any special action on my part.
The only workarounds I have found so far are to restart and hope, or to delete several large Docker directories, and recreate them empty. Then after a restart and pull and run works again. But I'm now not sure that it always will.
I am running with Docker version 17.05.0-ce on Debian 9. My images were built with Docker version 17.03.2-ce on Amazon Linux, and are based on the official Ubuntu image.
Has anyone had this kind of problem, or know a way to reset the state of Docker without deleting almost everything?
Two points:
1) It seems that changing the VM had nothing to do with it. On some boots Docker worked, on others not, with no change in configuration or contents.
2) At Google's suggestion I installed Stackdriver monitoring and logging agents, and I haven't had a problem through seven restarts so far.
My first guess is that there is a race condition on startup, and adding those agents altered it in my favour. Of course, I'd like to have a real fix, but for now I don't have the time to pursue the problem.

docker pull fails (not found) yet "number of pulls" increases

I am running docker on CentOS 7 following the official documentation from https://docs.docker.com
When I try to pull a demo image I just created, I got this error:
FATA[0013] Repository not found
The strange thing is that the "Number of Pulls" increases every time I try to pull it. As if every pull is successful.
Every time I get this same error: FATA[0013] Repository not found
So what should I do now?
Lastest Update: Problem solved. Thanks to Jerry Baker, one of the Docker Staff.
Please refer to https://forums.docker.com/t/cant-find-or-pull-public-repos-on-docker-hub/1806/6
UPDATE: I am not running docker under a http_proxy.
UPDATE 2: #user2915097 After I run docker events:
UPDATE 3:
My repo was not even found by docker search:
UPDATE 4:
docker push failed, too. I've already logged in (by docker login).
docker pull wings27/centos-web-dev is not working because it does not have the 'latest' tag. It tries to pull the 'latest' tag by default if you do not provide any tag in your pull command.
Login to your docker account before accessing private repos
docker login
If it still helps, short answer
docker login
docker tag <image_id> wings27/centos-web-dev:<your-tag>
docker pull wings27/centos-web-dev:<your-tag>

Resources