Docker Community Forums

Share and learn in the Docker community.

Docker push to private repository

I have a private repo running on 192.168.1.5
It is using TLS with a privately created SSL certificate.
I can login to the server from a remote machine from the command line using

docker login 192.168.1.5

This is because I copied my certificates to /etc/docker/certs.d/192.168.1.5 and /etc/docker/certs.d/192.168.1.5:443

When I try to push an image to this repo it pushes locally.

For example I have an image which I tagged 192.168.1.5:443/myimage:1

I note from this article How to use your own private local registry with Docker | Docker Blog that

t’s important to note that we’re using a domain containing a “.” here, i.e. localhost.domain . Docker looks for either a “.” (domain separator) or “:” (port separator) to learn that the first part of the repository name is a location and not a user name. If you just had localhost without either .localdomain or :5000 (either one would do) then Docker would believe that localhost is a username, as in localhost/ubuntu or samalba/hipache . It would then try to push to the default Central Registry. Having a dot or colon in the first part tells Docker that this name contains a hostname and that it should push to your specified location instead.

So the behaviour I would expect is that it would understand from the tag, which clearly contains a “:” in the first part that this is the remote server that I am logged into remotely that I wish to push to but still it pushes locally.

What am I doing wrong?

I’m only speculating here but could it be the wrong port - you’re only pushing it to the HTTPS port, whereas the registry generally runs on port 5000. Possibly you could use https://192.168.1.5:5000/myimage:1 to push the image. But this is just speculation…

You need to tag your image correctly first with your registryhost:

docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]
Then docker push using that same tag.

docker push NAME[:TAG]
Example:

docker tag 518a41981a6a myRegistry.com/myImage
docker push myRegistry.com/myImage