gpt4 book ai didi

linux - 在容器中运行 apt update && apt install -y sudo 失败

转载 作者:太空宇宙 更新时间:2023-11-04 04:53:35 32 4
gpt4 key购买 nike

我正在尝试在 Ubuntu 16.04 中启动此容器,步骤之一是:RUN apt update && apt install -y sudo

此步骤因暂时无法解析某些存储库而失败。这是此错误的输出:

Step 2/8 : RUN apt update && apt install -y sudo
---> Running in 15215f43b522

WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts.

Err http://security.debian.org jessie/updates InRelease

Err http://deb.debian.org jessie InRelease

Err http://apt.postgresql.org jessie-pgdg InRelease

Err http://security.debian.org jessie/updates Release.gpg
Temporary failure resolving 'security.debian.org'
Err http://deb.debian.org jessie-updates InRelease

Err http://apt.postgresql.org jessie-pgdg Release.gpg
Temporary failure resolving 'apt.postgresql.org'
Err http://deb.debian.org jessie Release.gpg
Temporary failure resolving 'deb.debian.org'
Err http://deb.debian.org jessie-updates Release.gpg
Temporary failure resolving 'deb.debian.org'
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/jessie/InRelease

W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/InRelease

W: Failed to fetch http://security.debian.org/dists/jessie/updates/InRelease

W: Failed to fetch http://apt.postgresql.org/pub/repos/apt/dists/jessie-pgdg/InRelease

W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg Temporary failure resolving 'security.debian.org'

W: Failed to fetch http://deb.debian.org/debian/dists/jessie/Release.gpg Temporary failure resolving 'deb.debian.org'

W: Failed to fetch http://apt.postgresql.org/pub/repos/apt/dists/jessie-pgdg/Release.gpg Temporary failure resolving 'apt.postgresql.org'

W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/Release.gpg Temporary failure resolving 'deb.debian.org'

W: Some index files failed to download. They have been ignored, or old ones used instead.
Building dependency tree...
Reading state information...
All packages are up to date.

WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package sudo

我能够 ping 通我的主机上的存储库。但上面的输出似乎表明这些主机无法从出现的容器中执行 ping 操作。

感谢任何帮助。

最佳答案

似乎 DNS 无法解析。您可以尝试以下两种解决方案之一:

  1. 使用--dns=xx.xx.xx.xx启动容器。

类似docker run --dns=xx.xx.xx.xx images

  • 修改宿主机中的/etc/docker/daemon.json,修改后重启docker daemon。
  • 将如下内容添加到 daemon.json:

    {
    "dns":[xx.xx.xx.xx]
    }

    关于linux - 在容器中运行 apt update && apt install -y sudo 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52711614/

    32 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com