简体   繁体   中英

Docker push to private registry issues

Here is what I have setup:

Docker daemon running as insecure registry as below:

docker -d --iptables=true --insecure-registry 1.2.3.4:5000

Now, when I try to push to that registry from a remote system it is giving me different errors.

Error 1:

docker push 1.2.3.4:5000/test
EOF error: 
FATA[0002] Error: Invalid registry endpoint 1.2.3.4:5000/v1: Get 1.2.3.4:5000/v1/_ping: EOF 

Error 2: After getting error 2, I added the ip to the /etc/hosts on the docker host. If I try "docker push docker:5000/test" it tries to use https and fails with Error 1 and if I try "docker push docker/test", it is asking me for a username and password. Is this expected ??

Error:
The push refers to a repository [docker/test] (len: 1)
Sending image list

Please login prior to push:
Username: docker
Password:
Email: docker@internet.com

FATA[0011] Error response from daemon: Registration: "Forbidden username"

If it needs authentication, where can I find my username and password. Also can I start the docker registry without authentication ??

Once you have your private registry running you need to retag the image you want to upload. Assuming the command docker images returns a image called jason/test you use the docker tag command to copy it with a new name:

docker tag jason/test <server.name>:<port>/<image name>

Assuming that your internal docker registry is accessible via the dns name myregistry.mycompany.local and it running on the default port of 5000 the command would look like:

docker tag jason/test myregistry.mycompany.local:5000/test

The docker images command will now show:

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
myregistry.mycompany.local:5000/test   latest              c776f089e3cf        6 days ago          707.3 MB
jason/test               latest              c776f089e3cf        6 days ago          707.3 MB

Now you can run docker push myregistry.mycompany.local:5000/test to push the image to your internal registry.

Running the Docker daemon with the argument --insecure-registry does not start an insecure registry, it just allows it to connect to one.

The command docker push 1.2.3.4:5000/test was trying to connect to a registry at 1.2.3.4:5000 , but it doesn't exist, so it errors out.

The command docker push docker/test tries to push to the official Docker Hub, which requires you to have set up an account, hence asking you for a username and password.

Have a look at the Github repository for the registry for details on how to run your own registry.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM