在Docker容器wget失败,似乎http代理不起作用在Centos 7.3

我遇到了一个问题:Docker容器中的wget失败(CentOS 7.3)。 我在网络上搜索了相关的解决方案,试了一下,但是“wget”还是不行。

如何调试该问题? 任何人都可以帮助我? 谢谢

详细步骤如下:

  1. 在CentOS 7.3上安装docker-ce 17.06.0
  2. /etc/systemd/system/docker.service.d/http-proxy.conf设置http_proxy
  3. 刷新changese: sudo systemctl daemon-reload
  4. 重启Docker: sudo systemctl restart docker
  5. 运行一个容器
  6. 在容器中,ping http代理成功,但在Docker容器中发生“wget”失败。
  7. 尝试在/etc/default/docker/etc/sysconfig/docker docker中设置代理,甚至用http代理启动dockerd。 但仍然失败

================================================== ======================

 [root@nettra ~]# docker info|grep Proxy WARNING: overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior. Reformat the filesystem with ftype=1 to enable d_type support. Running without d_type support will not be supported in future releases. Http Proxy: http://135.245.48.34:8000/ Https Proxy: http://135.245.48.34:8000/ No Proxy:localhost,localhost.localdomain,127.0.0.1,135.1.29.42,135.251.50.10 [root@nettra ~]# 

在host ==>中运行“wget”(通过代理135.245.48.34:8000)

 [root@nettra ~]# wget http_xxx --2017-07-25 12:33:23-- http_xxx Connecting to 135.245.48.34:8000... connected. Proxy request sent, awaiting response... 200 OK Length: unspecified [application/x-sh] Saving to: 'homer_installer.sh.1' [ <=> ] 32,671 124KB/s in 0.3s 2017-07-25 12:33:26 (124 KB/s) - 'homer_installer.sh.1' saved [32671] [root@nettra ~]# 

但在容器中运行“wget”==>失败(看起来代理不起作用)[root @ nettra〜]#docker run -i -t test / bin / bash

 [root@dc95e2dc1597 /]# wget http_xxx --2017-07-25 04:38:38-- http_xxx Resolving cdn.rawgit.com (cdn.rawgit.com)... 198.232.125.81 Connecting to cdn.rawgit.com (cdn.rawgit.com)|198.232.125.81|:443... failed: Connection timed out. Retrying. 

ping http proxy ==>成功

 [root@dc95e2dc1597 /]# ping 135.245.48.34 PING 135.245.48.34 (135.245.48.34) 56(84) bytes of data. 64 bytes from 135.245.48.34: icmp_seq=1 ttl=237 time=267 ms 64 bytes from 135.245.48.34: icmp_seq=2 ttl=237 time=252 ms 64 bytes from 135.245.48.34: icmp_seq=3 ttl=237 time=252 ms 64 bytes from 135.245.48.34: icmp_seq=4 ttl=237 time=252 ms ^C --- 135.245.48.34 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 2999ms rtt min/avg/max/mdev = 252.072/255.956/267.068/6.448 ms 
Interesting Posts