Experienced a strange issue today while rebuilding one of my Python containers which was failing on
The problem is strange because internet works fine on my host system (that also uses Google's 126.96.36.199). Seems to be a temporary issue, possibly because of a DNS change on part of the python module registry pythonhosted.org, but I can't be sure.
---> fc2678812fdf Step 9/11 : RUN python -m pip install --no-cache-dir -r requirements.txt ---> Running in 50711357a3eb Collecting aiohttp (from -r requirements.txt (line 1)) Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fce4cec2898>, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)')': /packages/09/7f/95e1f38eb778c76b1d5f008efc9f3d648dadd22275497a038ee0844dcd62/aiohttp-3.1.3-cp36-cp36m-manylinux1_x86_64.whl Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fce4cec2be0>: Failed to establish a new connection: [Errno 113] No route to host',)': /packages/09/7f/95e1f38eb778c76b1d5f008efc9f3d648dadd22275497a038ee0844dcd62/aiohttp-3.1.3-cp36-cp36m-manylinux1_x86_64.whl ... Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/09/7f/95e1f38eb778c76b1d5f008efc9f3d648dadd22275497a038ee0844dcd62/aiohttp-3.1.3-cp36-cp36m-manylinux1_x86_64.whl (Caused by NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fce4cebc400>: Failed to establish a new connection: [Errno 113] No route to host',))
Switching to another DNS service fixes the issue.
[sudo] vi /etc/docker/daemon.json
- Set the DNS resolvers to something new
"dns": ["188.8.131.52", "184.108.40.206", "220.127.116.11"]
18.104.22.168which is Cloudflare's new DNS service.
- Restart the docker daemon:
[sudo] systemctl restart docker
- Rebuild your container