I'm following the fig guide to using docker with a python application, but when docker gets up to the command
RUN pip install -r requirements.txt
I get the following error message:
Step 3 : RUN pip install -r requirements.txt
---> Running in fe0b84217ad1
Collecting blinker==1.3 (from -r requirements.txt (line 1))
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', gaierror(-2, 'Name or service not known'))': /simple/blinker/
This repeats several times and then I get another message:
Could not find any downloads that satisfy the requirement blinker==1.3 (from -r requirements.txt (line 1))
No distributions at all found for blinker==1.3 (from -r requirements.txt (line 1))
So for some reason pip can't access any packages from inside a docker container. Is there anything I need to do to allow it internet access?
However pip works fine to install things outside of the docker container, and worked fine even with that exact package (blinker==1.3
) so that's not the problem. Also this problem isn't specific to that package. I get the same issue with any pip install
command for any package.
Does anyone have any idea what's going on here?
Configuring docker DNS to Google DNS (8.8.8.8) or 10.0.0.2 did not work in my company environment.
Running: $ drill @8.8.8.8 www.amazon.com or @10.0.0.2 confirmed this.
In order to find a DNS that would work I ran: $ drill www.amazon.com and it gave me the DNS IP that is being used in my network.
Then I set it in Ubuntu using the following step to configure docker's DNS.
Changed dns in /etc/docker/daemon.json
For Ubuntu users
You need to add new DNS addresses in the docker config
Add the dns after ExecStar.
Should look like that:
Then do:
Should work.
Im new to Docker and tried all the methods mentioned here, but still didn't get it right. the Docker version was 18, and ubuntu version was 16. I tried this method:- First i was building docker with company's internet network. this network is blocking some sites or some how things didnt go well here. So secondly i connected to my very own network(which im using in mobile phone, for example) and tried. things went right. requirement.txt was installed successfully, and docker was build.
This was the solution for me:
For me simply restarting docker daemon helped.
Let it run. Sometimes pypi is having connection issues which are noisily put in your face to make you think it is broke. Just to be sure, let it roll, you might find it works it out for itself.
The bottom line, despite these red error lines, is "Successfully built"