【问题标题】:Unable to execute "apt-get update" in ubuntu image created by docker : Extended无法在 docker 创建的 ubuntu 映像中执行“apt-get update”:扩展
【发布时间】:2018-07-09 21:33:28
【问题描述】:

我知道在其他几个地方也有人问过这个问题,但我已经阅读了大部分帖子,但仍然无法在这里找到解决我的问题的方法。我正在尝试在 Docker for Windows 创建的 Ubuntu 映像中执行 apt-get update 命令。以下是我遵循的步骤:

  1. 提取 Ubuntu 14.04 的映像并运行它。
  2. 然后将我的图像附加到一个容器,然后运行它以打开 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 它。让我试着改变一下,看看会发生什么。

标签: ubuntu docker


【解决方案1】:

您应该将您的发行版从 14 升级到 16。因为更新支持 Ubuntu 14。

【讨论】:

  • 但我认为这不能解决问题。尽管如此,网站http://archive.ubuntu.com/ubuntu/ 仍然可以访问。
  • 但是,我尝试为 Ubuntu 16.04 创建更新的映像,但没有成功。还是同样的问题。
  • 可能是服务器错误导致的。更换服务器即可解决问题。 goto: Software & Updates > Server > Other Select the best server
  • 你能详细说明一下吗?
  • Ubuntu 对每个国家都有不同的服务器。在您当前的服务器上找不到您的 ubuntu 映像尝试更新的文件。更改服务器可能会解决您的问题。按超级键搜索软件和更新将服务器更改为“主服务器”
猜你喜欢
  • 1970-01-01
  • 2022-08-15
  • 1970-01-01
  • 2020-10-18
  • 2017-11-09
  • 2021-12-09
  • 1970-01-01
  • 1970-01-01
  • 2019-10-05
相关资源
最近更新 更多