简体   繁体   English

无法将映像推送到私有 docker 注册表

[英]Not able to push image to private docker registry

After setting up a private docker registry on a server within my network, I'm not able to push images to it.在我网络内的服务器上设置私有 docker 注册表后,我无法将图像推送到它。 Setup was done as following:设置如下:

  1. setup a private docker registry according to docker documentation根据docker 文档设置私有 docker 注册表
  2. got a ssl certificate by the hosting-provider for the desired domain获得了所需域的托管提供商的 ssl 证书
  3. created a directory /certs on the registry server (192.xxx) and placed .cert and .key files there在注册服务器 (192.xxx) 上创建了一个目录/certs并将.cert.key文件放在那里
  4. added domain to my local machine's host file 192.xxx example.com将域添加到我的本地计算机的主机文件192.xxx example.com
  5. able to ping the server using the domain能够使用域 ping 服务器
  6. tagged an image as example.com/my-image and tried to push将图像标记为example.com/my-image并尝试推送

But I'm always getting the error Get https://example.com/v2/ Bad Gateway但我总是收到错误Get https://example.com/v2/ Bad Gateway

What am I doing wrong?我究竟做错了什么?

I think you need to authenticate to the repository you are trying to push the image to.我认为您需要对您尝试将图像推送到的存储库进行身份验证。 Docker Command: docker login <address_to_your_repository> . Docker 命令: docker login <address_to_your_repository> It should prompt you for credentials.它应该提示您输入凭据。

The docker documentation shows that docker registry is started on port 5000, while your tag/push seems to not take that into account. docker 文档显示 docker 注册表是在端口 5000 上启动的,而您的标签/推送似乎没有考虑到这一点。

I would try to 2 things:我会尝试两件事:

  • check from the client that you can access the port of the server on which you started the registry.从客户端检查您是否可以访问启动注册表的服务器的端口。 A command like "curl example.com:5000" should not say connection refused像“curl example.com:5000”这样的命令不应该说连接被拒绝
  • include the port in the tag, meaning use "example.com:5000/my-image" if you used port 5000在标签中包含端口,这意味着如果您使用端口 5000,请使用“example.com:5000/my-image”

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

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