【发布时间】:2018-07-09 21:33:28
【问题描述】:
我知道在其他几个地方也有人问过这个问题,但我已经阅读了大部分帖子,但仍然无法在这里找到解决我的问题的方法。我正在尝试在 Docker for Windows 创建的 Ubuntu 映像中执行 apt-get update 命令。以下是我遵循的步骤:
- 提取 Ubuntu 14.04 的映像并运行它。
- 然后将我的图像附加到一个容器,然后运行它以打开 Ubuntu 终端。
在终端,我正在尝试做
`apt-get 更新'
但它失败并显示以下消息:
Err http://archive.ubuntu.com trusty InRelease
Err http://archive.ubuntu.com trusty-updates InRelease
Err http://archive.ubuntu.com trusty-backports InRelease
Err http://archive.ubuntu.com trusty Release.gpg
Unable to connect to archive.ubuntu.com:http: [IP: 99.999.99.999.99]
Err http://archive.ubuntu.com trusty-updates Release.gpg
Unable to connect to archive.ubuntu.com:http: [IP: 99.999.99.999.99]
Err http://archive.ubuntu.com trusty-backports Release.gpg
Unable to connect to archive.ubuntu.com:http: [IP: 99.999.99.999.99]
Err http://security.ubuntu.com trusty-security InRelease
Err http://security.ubuntu.com trusty-security Release.gpg
Unable to connect to security.ubuntu.com:http: [IP: 99.100.99.100.99]
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/InRelease
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/InRelease
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg Unable to connect to archive.ubuntu.com:http: [IP: 99.999.99.999.99]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg Unable to connect to archive.ubuntu.com:http: [IP: 99.999.99.999.99]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/Release.gpg Unable to connect to archive.ubuntu.com:http: [IP: 99.999.99.999.99]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg Unable to connect to security.ubuntu.com:http: [IP: 99.100.99.100.99]
W: Some index files failed to download. They have been ignored, or old ones used instead.
我查看了人们在这个社区以及其他一些人提到的各种解决方案,但没有运气。我也提到了这个post,但没有运气。根据这篇文章,我们需要使用我们系统的主要和次要 DNS 地址更新 docker config 文件夹中的 daemon.json 文件。
在 Linux 系统中,这个 daemon.json 文件位于 /etc/docker/config/ 路径,而在 Windows 中,它位于 %programdata%/docker/config/ 位置。由于我使用的是 Windows,因此我使用后来的位置文件来更新此信息,然后重新启动我的 docker 并通过创建新图像重复这些步骤。但一点运气都没有。
注意:IP 地址已更改,仅用于在此处发布。我还为 Ubuntu 16.04 的映像尝试了相同的步骤,但仍然会出现相同的问题。
【问题讨论】:
-
你能ping通archive.ubuntu.com的ip吗? /etc/resolve.conf 是什么样子的?你能 ping 那里列出的 dns 服务器吗?
-
是的。我可以 ping 它并获得响应,没有任何问题。
-
但是当我尝试 ping 错误消息中的 IP 地址时,我无法成功 ping 它。让我试着改变一下,看看会发生什么。