Docker: Failed to establish a new connection: [Errno 113] No route to host
Experienced a strange issue today while rebuilding one of my Python containers which was failing on pip install.
The problem is strange because internet works fine on my host system (that also uses Google's 8.8.8.8). 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(Solution
Switching to another DNS service fixes the issue.
[sudo] vi /etc/docker/daemon.json- Set the DNS resolvers to something new
"dns": ["1.0.0.1", "8.8.8.8", "8.8.4.4"]
I added1.0.0.1which is Cloudflare's new DNS service. - Restart the docker daemon:
[sudo] systemctl restart docker - Rebuild your container