在archive.ubuntu.comDocker中执行apt-get更新时出现“解决' www.example.com '临时失败”错误

xvw2m8pv  于 2023-02-15  发布在  Hive
关注(0)|答案(1)|浏览(196)

我知道这个问题在这里已经谈过了:Docker build "Could not resolve 'archive.ubuntu.com'" apt-get fails to install anything
我尝试使用ubuntu:16.04构建一个docker映像,并尝试运行apt-get update,但它会抛出此错误

Err:1 http://archive.ubuntu.com/ubuntu xenial InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

我尝试了上面链接中的解决方案,但似乎仍然没有解决我的问题。我创建了包含适当DNS地址的daemon.json,并将其放置在/etc/docker/中,如前所述,并重新启动docker,但仍然没有解决我的问题。我尝试了另一个可接受的答案,即我们将DNS地址添加到/etc/default/docker中,但也没有工作。如果有帮助,我正在通过大学网络上网。
这个问题还有别的解决办法吗?

cbjzeqam

cbjzeqam1#

编辑下面的文件并添加列出的名称服务器
sudo vi /etc/解析配置文件
名称服务器8.8.8.864.104.128.23672.163.128.1408.8.8.864.104.128.23672.163.128.140服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务器名称服务192.168.1.1
有关更多详细信息,请参阅How do I edit resolv.conf?

相关问题