Unable to connect to docker hub from China
Asked Answered
A

2

4

I'm getting the same thing every time trying to run busybox either with docker on fedora 20 or running boot2docker in VirtualBox:

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

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

Currently in China where there basically is no Internet due to the firewall, npm, git and wget seem to use the Astrill proxy in the terminal (when setting it in network setting of Fedora 20) but somehow I either can't get the docker daemon to use it or something else is wrong.

Aubigny answered 25/5, 2015 at 9:15 Comment(0)
A
3

It seems the answer was not so complicated according to the following documentation (had read it before but thought setting proxy in network settings ui would take care of it)

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/"

In the Astrill app (I'm sure other provider application provide something similar) there is an option for vpn sharing which will create a proxy; it can be found under settings => vpn sharing.

For git, npm and wget setting the proxy in the ui (gnome-control-center => Network => network proxy) is enough but when doing a sudo it's better to do a sudo su, set the env and then run the command needing a proxy, for example:

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 ...
Aubigny answered 25/5, 2015 at 12:54 Comment(3)
yes, but the vpn sharing option is not free :-(.... Any idea how i could do please ?Ferruginous
@mh-cbon I'm sorry, even with vpn; China has no Internet. Other than wechat, games and youku it's quite useless. Some of my Chinese friends use free proxies that will work for them but they can read Chinese and find it quite easily. I got too tired to debug VPN and bad DNS in China so now live in a country that has Internet :-)Aubigny
in fact, 1 lived in china too, i know that as well, 2/ the problem happened to me back in my country (still a dictatorship, but internet is better ;) !!! Before i would not use docker.. so i did not have this very very very stupid problem.Ferruginous
E
1

I'd like to update the solution for people who still encounter this issue today

I don't know the details, but when using the wireguard protocol on Astrill, docker build and docker run will use the VPN. If for some reason it doesn't work, try restarting the docker service sudo service docker restart while the VPN is active

Hope it helps, I just wasted one hour trying to figure out why it stopped working

Elna answered 5/7, 2020 at 15:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.