Failed to connect to docker hub from China

I get the same thing every time I try to start busybox with either docker on fedora 20 or run boot2docker in VirtualBox:

[me @localhost ~] $ docker run -it busybox Can't find image 'busybox: latest' local Pulling repository busybox FATA [0105] Get https://index.docker.io/v1/repositories/library/busybox/images : read tcp 162.242.195.84:443: timeout i / o

I can open https://index.docker.io/v1/repositories/library/busybox/images in a browser and sometimes without using a vpn tunnel, so I tried to set the proxy in network settings to the proxy provided by Astrill when using VPN sharing, but there will always be a timeout.

Currently in China, where there is mostly no internet due to firewall, npm, git and wget seem to use Astrill proxy in the terminal (when configured in Fedora 20 network settings), but I either "t get the docker daemon" use it or something else is wrong.

+3


source to share


1 answer


It seems the answer was not that complicated according to the following documentation (read it before, but the proxy thought of setting in ui network settings taking care of this)

So added the following to /etc/systemd/system/docker.service.d/http-proxy.conf

(after creating the docker.service.d directory and conf file):

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

      



The Astrill app (I'm sure another vendor app provides something similar) has an option for vpn sharing that will create a proxy; it can be found under settings => vpn sharing.

For git, npm and wget, setting up a proxy in the ui (gnome-control-center => Network => network proxy) is sufficient, but when running sudo it is better to do sudo su

, install env and then run the command that requires a proxy, like:

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 ...

      

+3


source







All Articles