Error running PIP command on Docker

Asked

Viewed 200 times

1

I have a python project that runs inside a Docker.

When the image (Build) is mounted rele da um

RUN pip install -r requirements.txt 

but when it executes the command returns a connection error.

Dockerfile Completo

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
  • Could not find a version that satisfies the requirement Flask==1.0.0, does not seem to exist version 1.0.0 (releases)

  • exists, but this happens to any package that is installed

  • you have already tried to upgrade the version of Python to python:3.6?

  • all versions, the problem is in the communication between the Pip in the container and the server where it should fetch the packages

  • Is using some repository Pip different from the standard? The container is in the network default of Docker? The network default Docker has internet access - by error the problem is DNS?

  • I am using everything padão, I have normal network access, only the Pip command does not work, I tried other images, Ubuntu, debian and etc, but all are with problem in Pip, I already made a test with projects in Github already ready but Dam the same error, and also tried on different machines in mine, at work and on an external server

Show 1 more comment

1 answer

0


I managed to solve the problem,

Here in the company uses NET and by default they block most of the doors, what happened was that the PYP did not make the communication by door lock, I requested the unlocking of all ports on the NET and now it works normally

Browser other questions tagged

You are not signed in. Login or sign up in order to post.