Error when running PIP command in Docker

1

I have a python project that runs inside a Docker.

When the (Build) image is assembled reliably from a

RUN pip install -r requirements.txt 

but when it executes the command it returns a connection error.

Complete Dockerfile

FROM python:3.5

ADD ./app /app
WORKDIR /app
EXPOSE 5000
RUN pip install -r requirements.txt 
CMD ["python", "app.py"]

Error:

docker-compose build

Building socket
Step 1/6 : FROM python:3.5
 ---> e649f67bb435
Step 2/6 : ADD ./app /app
 ---> 92af2870125a
Step 3/6 : WORKDIR /app
Removing intermediate container e08611d47e59
 ---> cfa7b0c4904f
Step 4/6 : EXPOSE 5000
 ---> Running in c84d2c2adc31
Removing intermediate container c84d2c2adc31
 ---> 8d23ccfe53ff
Step 5/6 : RUN pip install -r requirements.txt
 ---> Running in 8f02d2e43eee
Collecting Flask==1.0.0 (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 0x7f5742caec50>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/flask/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5742caeac8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/flask/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5742cae908>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/flask/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5742caecf8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/flask/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5742cae668>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/flask/
  Could not find a version that satisfies the requirement Flask==1.0.0 (from -r requirements.txt (line 1)) (from versions: )
No matching distribution found for Flask==1.0.0 (from -r requirements.txt (line 1))
ERROR: Service 'socket' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Makefile:2: recipe for target 'build' failed
make: *** [build] Error 1ne)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5742caeac8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/flask/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5742cae908>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/flask/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5742caecf8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/flask/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5742cae668>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/flask/
  Could not find a version that satisfies the requirement Flask==1.0.0 (from -r requirements.txt (line 1)) (from versions: )
No matching distribution found for Flask==1.0.0 (from -r requirements.txt (line 1))
ERROR: Service 'socket' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Makefile:2: recipe for target 'build' failed
make: *** [build] Error 1
    
asked by anonymous 05.06.2018 / 22:09

1 answer

0

I was able to solve the problem,

Here in the company uses NET and by default they block most of the ports, what happened was that the PYP did not do the communication by blocking the port, I requested the unlock of all the ports in NET and now it is working normalme

    
14.06.2018 / 18:12