简体   繁体   English

Docker推动私有注册表问题

[英]Docker push to private registry issues

Here is what I have setup: 这是我设置的内容:

Docker daemon running as insecure registry as below: Docker守护程序作为不安全的注册表运行,如下所示:

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: 错误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. 错误2:收到错误2后,我将ip添加到了Docker主机上的/ etc / hosts中。 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. 如果我尝试“ docker push docker:5000 / test”,它将尝试使用https并失败,并显示错误1;如果我尝试“ docker push docker / test”,它将要求我输入用户名和密码。 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 ?? 我也可以在没有身份验证的情况下启动Docker注册表吗?

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 images返回一个名为jason / test的图像,您使用docker tag命令以新名称复制它:

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注册表可通过dns名称myregistry.mycompany.local进行访问,并且它在默认端口5000上运行,则命令如下所示:

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

The docker images command will now show: docker images命令现在将显示:

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. 现在您可以运行docker push myregistry.mycompany.local:5000 / test将映像推送到内部注册表。

Running the Docker daemon with the argument --insecure-registry does not start an insecure registry, it just allows it to connect to one. 使用参数--insecure-registry运行Docker守护程序不会启动不安全的注册表,它只允许它连接到一个。

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. 该命令docker push 1.2.3.4:5000/test试图在连接到注册表1.2.3.4:5000 ,但它不存在,所以它的错误了。

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. docker push docker/test命令尝试推送到正式的Docker Hub,这需要您设置一个帐户,因此要求您提供用户名和密码。

Have a look at the Github repository for the registry for details on how to run your own registry. 查看注册表Github存储库,以获取有关如何运行自己的注册表的详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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