简体   繁体   中英

docker fails to install dependencies

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM