无法连接到来自中国的docker中心

每次尝试使用Fedora 20上的docker运行busybox或在VirtualBox中运行boot2docker时,我都会得到相同的结果:

[me @ localhost〜] $ docker run -it busybox无法在本地查找图像'busybox:latest'拉取资源库busybox FATA获取https://index.docker.io/v1/repositories/library/busybox/images :读取tcp 162.242.195.84:443:I / O超时

我可以在浏览器中打开https://index.docker.io/v1/repositories/library/busybox/images ,有时候不使用vpn隧道,因此在使用Astrill时提供的代理在networking设置中尝试设置代理VPN共享,但总是会超时。

目前在中国,由于防火墙基本上没有互联网,npm,git和wget似乎在terminal中使用Astrill代理(在Fedora 20的networking设置中设置它),但是不知何故我不能得到docker守护进程使用它或其他东西是错误的。

根据以下文档 ,答案似乎并不那么复杂(之前已经阅读过,但认为在networking设置中设置代理将会处理它)

所以添加到/etc/systemd/system/docker.service.d/http-proxy.conf (在创builddocker.service.d目录和conf文件之后):

 [Service] Environment="HTTP_PROXY=http://localhost:3213/" Environment="HTTPS_PROXY=http://localhost:3213/" 

在Astrill应用程序(我相信其他提供商应用程序提供类似的东西)有一个选项,为VPN共享将创build一个代理; 它可以在settings => vpn共享下find。

对于git,npm和wget在ui(gnome-control-center => Network =>networking代理)中设置代理就足够了,但是在做sudo的时候,最好做一个sudo su ,设置env然后运行需要的命令一个代理,例如:

 sudo su export http_proxy=http://localhost:3213/ export ftp_proxy=http://localhost:3213/ export all_proxy=socks://localhost:3213/ export https_proxy=http://localhost:3213/ export no_proxy=localhost,127.0.0.0/8,::1 export NO_PROXY="/var/run/docker.sock" npm install -g ...