VM中Docker私有注册表的代理设置

时间:2018-01-24 17:11:32

标签: docker proxy virtual-machine docker-registry

各位同事和同事们,我的想法已经不多了。

我的主要问题是我的docker客户端VM无法连接到另一个VM中的私有注册表并抛出错误:

  

user @ ubuntu:〜$ docker push 192.168.14.147:5000/hello-world   推送指的是存储库[192.168.14.147:5000/hello-world]   获取https://192.168.14.147:5000/v2/:net / http:请求在等待连接时被取消(等待标题时超出Client.Timeout)

我目前的设置:

  • 我在端口5000上运行docker注册表的一个VM(Ubuntu 16.03)(VM-IP:192.168.14.147)
  • 当我尝试使用推送/拉入注册表VM时 docker push 127.0.0.1:5000/hello-world它正确地推送和拉出标记图像,因此注册表正在运行
  • 一个虚拟机(Ubuntu 16.03),我在那里运行我的docker"客户端"并希望推/拉(VM-IP:192.168.14.148)
  • 我可以通过终端
  • 中的ping 192.168.14.147(。148)联系两个VM
  • 两个虚拟机都具有通过bash脚本提供的以下(完全正常工作)代理设置:
echo "export http_proxy=http://10.8.31.1:8080
export https_proxy=http://10.8.31.1:8080" >> /etc/bash.bashrc
echo "export http_proxy=http://10.8.31.1:8080
export https_proxy=http://10.8.31.1:8080" >> /etc/environment
echo "Acquire::http::Proxy \"http://10.8.31.1:8080\";
Acquire::https::Proxy \"http://10.8.31.1:8080\";" >> /etc/apt/apt.conf

和(工作)Docker Environment指定为

 echo "[Service]
 Environment=\"HTTP_PROXY=http://10.8.31.1:8080/\""  /etc/systemd/system/docker.service.d/http-proxy.conf
 touch /etc/systemd/system/docker.service.d/https-proxy.conf
 echo "[Service]
 Environment=\"HTTPS_PROXY=https://10.8.31.1:8080/\""  /etc/systemd/system/docker.service.d/https-proxy.conf
  • 两台虚拟机都在同一台主机上运行
  • 在此guide
  • 之后提供自签名证书

在家里我没有代理就克隆了这个设置,效果很好。因此,似乎缺乏有关网络/代理问题的知识,而不是证书。

我在docker http(s)-proxy.conf

中尝试了这个solution

[Service] Environment="HTTP_PROXY=http://10.8.31.1:8080/" Environment="NO_PROXY=192.168.14.147"

因为它可能被转发到代理服务器并且无法在那里找到注册表IP但却无法正常工作。

我在这个主题上投入了大量精力,非常感谢任何帮助。

0 个答案:

没有答案