0

I am learning docker while following this tutorial: https://docs.docker.com/get-started/part2/

Everything seems okay but When I run docker build --tag=learndocker . it starts failing in the line that is supposed to install dependencies. Here is the error:

Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb5eee1f1d0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/click/
  Could not find a version that satisfies the requirement Click==7.0 (from -r requirements.txt (line 1)) (from versions: )
No matching distribution found for Click==7.0 (from -r requirements.txt (line 1))
The command '/bin/sh -c pip install --trusted-host pypi.python.org -r requirements.txt' returned a non-zero code: 1

Here is my requirements.txt content:

Click==7.0
Flask==1.0.2
itsdangerous==1.1.0
Jinja2==2.10
MarkupSafe==1.1.1
pkg-resources==0.0.0
redis==3.2.0
Werkzeug==0.14.1
Eric O.
  • 474
  • 4
  • 23

2 Answers2

1

This is probably a DNS problem - see the comments on Dns settings here : https://docs.docker.com/get-started/part2/

DNS settings

DNS misconfigurations can generate problems with pip. You need to set your own DNS >server address to make pip work properly. You might want to change the DNS >settings of the Docker daemon.

Community
  • 1
  • 1
bmat
  • 224
  • 3
  • 5
  • I've tried that. Checking for my DNS address returns three addresses. I don't know which is which. `IP4.DNS[1]: 192.168.3.2` `IP4.DNS[2]: 192.168.3.14` `IP4.DNS[1]: 192.168.137.1` – Eric O. Mar 04 '19 at 15:22
  • I have tried to use all of the above DNS addresses and also left the DNS address part out but still getting the same error – Eric O. Mar 04 '19 at 15:35
  • Hmm... did you remember to restart the docker daemon after making changes to /etc/docker/daemon.json ? and did you try adding googles dns server (8.8.8.8) ? – bmat Mar 04 '19 at 15:52
  • Problem solved. It was about adding the DNS addresses to daemon.json. I have 3 DNS addresses but I was only adding one. I added all of them and all was well. – Eric O. Mar 04 '19 at 17:01
0

This is not an issue with docker. pip is not able to connect to the remote servers. The most relevant error message is:

Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)'

Are you sure your internet connection is fine? If you are using a proxy, checkout this question. However, it could also be that there is some temporary server outage.

Thomas Kainrad
  • 2,542
  • 21
  • 26