0

How do I push to a non-public repository on dockerhub?

Suppose the account is called “myaccount” and the (non-public) repo is called “myrepo”. In the repo page it says, “Pull this repository: docker pull myaccount/myrepo”.

E.g., suppose I have an image called “myrepo/myimage”. I have logged into my account (sudo docker login), and tried,

sudo docker push docker.io/myrepo/myimage
sudo docker push myrepo/myimage
sudo docker push myaccout:myrepo/myimage
sudo docker push myaccount/myrepo:myrepo/myimage
sudo docker push myaccount/myrepo:myimage

etc.

None of these work. I get errors like "Invalid repository name", or it succeeds but says, "Do you really want to push to public registry?" - and I do not - I want to push it to my non-public dockerhub repo ("myaccount/myrepo").

tedder42
  • 23,519
  • 13
  • 86
  • 102
cliffberg
  • 11
  • 2

1 Answers1

0

Please tag your image first as myaccount/myrepo:<tag-name> locally using
docker tag <your-local-image> myaccount/myrepo:<tag-name> and then try
docker push myaccount/myrepo:<tag-name>
Note Give a valid name for <tag-name> like v1, v2, etc.

Sabin
  • 11,662
  • 3
  • 25
  • 39
  • Thanks for this suggestion. I now see that tags are not just for versions. My two images are not different versions - they are totally independent images. So I would not use "v1" and "v2", but rather "SomeImage" and "SomeOtherImage". That's ok - I just did not realize that tags should be used that way. But I tried it, and I logged in, and after pushing I get the error message, "FATA[0006] Repository does not exist: docker.io//. Note that my repo is not public, but it does exist - I am looking at it right now. – cliffberg Jun 11 '15 at 22:17
  • how come docker.io in-front of `/` in the error message. You did tag locally as `/:`, right? – Sabin Jun 11 '15 at 22:28
  • I am using Centos, and it turns out that Red Hat has their own version of docker, and it requires that one put "docker.io" in front. What I needed to do was sudo docker tag docker.io//: and then sudo docker push docker.io//:. – cliffberg Jun 12 '15 at 23:56
  • In that case, you might want to replace the docker binary that Red Hat provided with the official docker binary: https://docs.docker.com/installation/binaries/ – Sabin Jun 13 '15 at 00:07