无法使用http代理

时间:2016-10-25 11:40:47

标签: containers ibm-cloud

我正在使用Bluemix容器服务,即使我已经配置了代理,也无法从防火墙后面进行cf ic登录。

当我这样做时

cf ic -v login

我收到错误消息:

  

使用IBM Containers注册表主机进行身份验证   registry.ng.bluemix.net ...失败尝试使用   IBM Containers注册表主机registry.ng.bluemix.net未成功。   ****警告:' -e'已弃用,将很快删除。见用法。来自守护程序的错误响应:Get   https://registry.ng.bluemix.net/v1/users/:拨打tcp   198.23.117.106:443:i / o timeout

要测试我的代理配置,我执行此操作:

  

wget https://registry.ng.bluemix.net/v1/users/

     

- 2016-10-25 11:25:23-- https://registry.ng.bluemix.net/v1/users/解析proxy-chain.intel.com(proxy-chain.intel.com)... 10.19.8.225   连接到proxy-chain.intel.com   (proxy-chain.intel.com)| 10.19.8.225 |:912 ...已连接。代理请求   发送,等待回复... 404未找到2016-10-25 11:25:24错误   404:未找到。

如果我断开VPN连接,以便我不再拥有防火墙并需要代理,并取消设置我的代理,它就能正常工作。

这些是我设置的代理:

  

printenv | grep -i proxy

     

http_proxy = http://proxy-chain.intel.com:911

     

ftp_proxy这= http://proxy-chain.intel.com:911

     

socks_proxy = http://proxy-chain.intel.com:1080

     

https_proxy = http://proxy-chain.intel.com:912

     

NO_PROXY = intel.com,.intel.com,10.0.0.0 / 8,192.168.0.0 / 16,本地主机,127.0.0.0 / 8,134.134.0.0 / 16   >

更多实验:

当我将代理设置为虚假的东西时,它会立即失败:

> export https_proxy=http://foobarsfsdf.com
> cf ic login
FAILED
auth request failed: Error performing request: Post https://login.ng.bluemix.net/UAALoginServerWAR/oauth/token: http: error connecting to proxy http://foobarsfsdf.com: dial tcp: lookup foobarsfsdf.com on 10.0.2.3:53: no such host
> 

当我正确设置代理时,它稍后失败:

> cf ic login
Deleting old configuration file...
Retrieving client certificates for IBM Containers...
Storing client certificates in /home/rscohn1/.ice/certs/...

Storing client certificates in /home/rscohn1/.ice/certs/containers-api.ng.bluemix.net/80cc2e8c-4df0-4700-bd04-77f2e8777f80...

OK
The client certificates were retrieved.

Checking local Docker configuration...
OK

Authenticating with the IBM Containers registry host registry.ng.bluemix.net...
FAILED
The attempt to authenticate with the IBM Containers registry host registry.ng.bluemix.net was unsuccessful.
****Warning: '-e' is deprecated, it will be removed soon. See usage.
Error response from daemon: Get https://registry.ng.bluemix.net/v1/users/: dial tcp 198.23.117.106:443: i/o timeout


When you are not connected to the IBM Containers registry host, you can run only a limited number of IBM Containers commands. Check the spelling of the host URL and try again. If the host URL is correct, open a new command line or terminal window before retrying.

看起来ic插件的某些部分使用代理,而某些部分则没有。

1 个答案:

答案 0 :(得分:0)

您需要将代理添加到Docker守护程序配置中。另请注意,正如Alex所说,您应该确保配置HTTPS代理。

有关如何在Linux上使用Systemd(Ubuntu 16.04+)的信息,请参阅此处:https://spring.io/guides/gs/scheduling-tasks/

对于较旧的Linux发行版,例如16.04之前的Ubuntu版本,Docker使用Upstart。您将在/etc/default/docker找到Upstart配置文件,其中包含如何在该文件中的注释中设置代理的示例。

如果您使用的是Docker for Mac或Docker for Windows应用,您可以在偏好设置 - >>中找到代理配置选项。 高级

确保在更改配置后重新启动Docker,以使更改生效。在Linux上:sudo service docker restart。在Mac或Windows上,右键单击Docker图标,然后单击重新启动