Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Temporary failure in name resolution [Errno -3] with Docker

I'm following the docker tutorial and am on the part where I have to build the app using:

docker build -t friendlyhello .

It reaches up to step 4, where after a pause I get this error:

Step 4/7 : RUN pip install -r requirements.txt
 ---> Running in 7f4635a7510a
Collecting Flask (from -r requirements.txt (line 1))

Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after 
connection broken by
'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection 
object at 0x7fe3984d9b10>: Failed to establish a new connection: 
[Errno -3] Temporary failure in name resolution',)': /simple/flask/

I'm not quite sure what this error means and how I can go about solving it.

Thanks for your help!

like image 828
monadoboi Avatar asked Jun 26 '17 13:06

monadoboi


4 Answers

I just did sudo service docker restart and it worked after. Definitely worth a shot before jumping in to modify your configurations.

like image 69
David Warnke Avatar answered Nov 18 '22 18:11

David Warnke


I got the same problem with Ubuntu 16.04 and Docker version 17.09.0-ce. I don't think disabling dnsmasq is the right solution.

Here is how I solved it:

For Ubuntu

Edit /etc/default/docker and add your DNS server to the following line:

Example

DOCKER_OPTS="--dns 8.8.8.8 --dns 10.252.252.252"

Reference: Network calls fail during image build on corporate network

like image 33
Jack Fan Avatar answered Nov 18 '22 19:11

Jack Fan


bkasap's answer changes a system's feature I would say is exaggerated. Further because there are options in docker to do that. The new way to do that is

$ sudo vi /etc/docker/daemon.json

and add following content

{
    "dns": ["8.8.8.8", "8.8.4.4"]
}

Don't forget to

sudo service docker restart
like image 25
JAR Avatar answered Nov 18 '22 19:11

JAR


It's silly, but I had a VPN connected when I got this error.

After disconnecting the VPN, PIP started working again.

like image 17
James Anderson Avatar answered Nov 18 '22 19:11

James Anderson