名称解析暂时失败[error -3]

时间:2022-07-20 23:40:11

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

我正在学习docker教程,并且正在使用以下部分构建应用程序:

docker build -t friendlyhello .

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

它到达步骤4,在暂停之后,我得到这个错误:

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!

谢谢你的帮助!

5 个解决方案

#1


7  

this post worked for me too!

这篇文章对我也很有用!

Solved by dns mask disable:

使用dns掩码解决:

sudo vim /etc/NetworkManager/NetworkManager.conf

sudo vim /etc/NetworkManager / NetworkManager.conf

comment out dns=dnsmasq -> #dns=dnsmasq

注释掉dns=dnsmasq -> #dns=dnsmasq

sudo service network-manager restart (or reboot VM in this case)

sudo服务网络管理器重新启动(在本例中是重新启动VM)

from: https://github.com/moby/moby/issues/26330

来自:https://github.com/moby/moby/issues/26330

#2


3  

I am having the same issue with Ubuntu 16.04.1 machine for docker-ce 17. Its got fixed by disable the dns mask in the network.

我对docker-ce 17的Ubuntu 16.04.1机器也有同样的问题。通过禁用网络中的dns掩码来修复它。

sudo nano /etc/NetworkManager/NetworkManager.conf 

Press Ctrl+O save and Enter the exit Ctrl+X

按Ctrl+O保存并输入退出Ctrl+X。

Restart the network service by running bellow command.

通过运行bellow命令重新启动网络服务。

sudo service network-manager restart

After this if you run the docker build command everything will work fine.

在此之后,如果您运行docker build命令,一切都会正常工作。

#3


3  

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

Ubuntu 16.04和Docker版本17.09.0-ce也有同样的问题。我不认为禁用dns掩码是正确的解决方案。

Here is how I solved it:

我是这样解决的:

For Ubuntu

对于Ubuntu

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

编辑/etc/default/docker并将您的DNS服务器添加到以下行:

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

示例DOCKER_OPTS="——dns 8.8.8.8——dns 10.252.252.252"

Reference: Docker - Network calls fail during image build on corporate network

参考:在公司网络上的图像构建过程中,Docker网络调用失败。

#4


0  

This error means your Docker container is unable to access your network. Beginning with systemd version 220, the forwarding setting for a given network (net.ipv4.conf..forwarding) defaults to off. This setting prevents IP forwarding. It also conflicts with Docker’s behavior of enabling the net.ipv4.conf.all.forwarding setting within containers.

这个错误意味着Docker容器无法访问您的网络。从systemd版本220开始,给定网络(net.ipv4.conf. forwarding)的转发设置默认为off。它还与Docker启用net.ipv4.con .all的行为相冲突。转发设置在容器内。

If your container needs to resolve hosts which are internal to your network, the public nameservers will not be adequate. You have two choices:

如果您的容器需要解析网络内部的主机,那么公共名称服务器就不够了。你有两个选择:

  1. You can specify a DNS server for Docker to use, or
  2. 您可以为Docker指定要使用的DNS服务器,或者
  3. You can disable dnsmasq in NetworkManager. If you do this, NetworkManager will add your true DNS nameserver to /etc/resolv.conf, but you will lose the possible benefits of dnsmasq. You only need to use one of these methods.
  4. 您可以在NetworkManager中禁用dnsmasq。如果您这样做,NetworkManager将向/etc/resolv添加您的真正的DNS名称服务器。当然,但是你会失去dnsmasq可能带来的好处。您只需要使用其中一种方法。

you can read about how to perform these steps here

您可以在这里阅读如何执行这些步骤

#5


0  

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

这很傻,但是当我犯这个错误时我有一个VPN连接。

After disconnecting the VPN, PIP started working again.

断开VPN连接后,PIP又开始工作了。

#1


7  

this post worked for me too!

这篇文章对我也很有用!

Solved by dns mask disable:

使用dns掩码解决:

sudo vim /etc/NetworkManager/NetworkManager.conf

sudo vim /etc/NetworkManager / NetworkManager.conf

comment out dns=dnsmasq -> #dns=dnsmasq

注释掉dns=dnsmasq -> #dns=dnsmasq

sudo service network-manager restart (or reboot VM in this case)

sudo服务网络管理器重新启动(在本例中是重新启动VM)

from: https://github.com/moby/moby/issues/26330

来自:https://github.com/moby/moby/issues/26330

#2


3  

I am having the same issue with Ubuntu 16.04.1 machine for docker-ce 17. Its got fixed by disable the dns mask in the network.

我对docker-ce 17的Ubuntu 16.04.1机器也有同样的问题。通过禁用网络中的dns掩码来修复它。

sudo nano /etc/NetworkManager/NetworkManager.conf 

Press Ctrl+O save and Enter the exit Ctrl+X

按Ctrl+O保存并输入退出Ctrl+X。

Restart the network service by running bellow command.

通过运行bellow命令重新启动网络服务。

sudo service network-manager restart

After this if you run the docker build command everything will work fine.

在此之后,如果您运行docker build命令,一切都会正常工作。

#3


3  

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

Ubuntu 16.04和Docker版本17.09.0-ce也有同样的问题。我不认为禁用dns掩码是正确的解决方案。

Here is how I solved it:

我是这样解决的:

For Ubuntu

对于Ubuntu

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

编辑/etc/default/docker并将您的DNS服务器添加到以下行:

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

示例DOCKER_OPTS="——dns 8.8.8.8——dns 10.252.252.252"

Reference: Docker - Network calls fail during image build on corporate network

参考:在公司网络上的图像构建过程中,Docker网络调用失败。

#4


0  

This error means your Docker container is unable to access your network. Beginning with systemd version 220, the forwarding setting for a given network (net.ipv4.conf..forwarding) defaults to off. This setting prevents IP forwarding. It also conflicts with Docker’s behavior of enabling the net.ipv4.conf.all.forwarding setting within containers.

这个错误意味着Docker容器无法访问您的网络。从systemd版本220开始,给定网络(net.ipv4.conf. forwarding)的转发设置默认为off。它还与Docker启用net.ipv4.con .all的行为相冲突。转发设置在容器内。

If your container needs to resolve hosts which are internal to your network, the public nameservers will not be adequate. You have two choices:

如果您的容器需要解析网络内部的主机,那么公共名称服务器就不够了。你有两个选择:

  1. You can specify a DNS server for Docker to use, or
  2. 您可以为Docker指定要使用的DNS服务器,或者
  3. You can disable dnsmasq in NetworkManager. If you do this, NetworkManager will add your true DNS nameserver to /etc/resolv.conf, but you will lose the possible benefits of dnsmasq. You only need to use one of these methods.
  4. 您可以在NetworkManager中禁用dnsmasq。如果您这样做,NetworkManager将向/etc/resolv添加您的真正的DNS名称服务器。当然,但是你会失去dnsmasq可能带来的好处。您只需要使用其中一种方法。

you can read about how to perform these steps here

您可以在这里阅读如何执行这些步骤

#5


0  

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

这很傻,但是当我犯这个错误时我有一个VPN连接。

After disconnecting the VPN, PIP started working again.

断开VPN连接后,PIP又开始工作了。