Docker Community Forums

Share and learn in the Docker community.

"Get started with Docker Compose" failing at pip install


(Ryanpridgeon) #1

Hi, I’m trying to follow the tutorial here https://docs.docker.com/compose/gettingstarted/

But when running using “docker-compose up”, the pip install command fails like so;

Step 4/5 : RUN pip install -r requirements.txt --trusted-host pypi.python.org
 ---> Running in d0a5b42404dc
Collecting flask (from -r requirements.txt (line 1))
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5c2b1338d0>: Failed to establish a new connection: [Errno -3] Try again',)': /simple/flask/

However, when I run using docker build it successfully compiles and runs;

docker build --no-cache --network=host -t friendlyhello .

...

Step 4/5 : RUN pip install -r requirements.txt --trusted-host pypi.python.org
 ---> Running in 53dfe143e914
Collecting flask (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/7f/e7/08578774ed4536d3242b14dacb4696386634607af824ea997202cd0edb4b/Flask-1.0.2-py2.py3-none-any.whl (91kB)
Collecting redis (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/3b/f6/7a76333cf0b9251ecf49efff635015171843d9b977e4ffcf59f9c4428052/redis-2.10.6-py2.py3-none-any.whl (64kB)

Could someone tell me why this doesn’t work with docker-compose like the tutorial states it should?

Thanks.