AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1171896
Accepted
Dmitriano
Dmitriano
Asked: 2025-01-30 03:36:20 +0800 CST2025-01-30 03:36:20 +0800 CST 2025-01-30 03:36:20 +0800 CST

无法在 Docker 容器内安装 build-essential

  • 772

我收到以下错误:

3.033 Err:32 http://security.ubuntu.com/ubuntu noble-updates/main amd64 linux-libc-dev amd64 6.8.0-51.52
3.034   404  Not Found [IP: 91.189.91.82 80]

尝试在 Docker 容器内运行以下命令时:

FROM ubuntu:24.04

RUN apt update
RUN apt upgrade

RUN apt -y install build-essential

这是与 DNS 相关的问题吗?

/etc/resolv.conf在 Docker 容器中:

# Generated by Docker Engine.
# This file can be edited; Docker Engine will not make further changes once it
# has been modified.

nameserver 172.236.0.51
nameserver 172.236.0.54
nameserver 172.236.0.48
nameserver 172.236.0.46
nameserver 172.236.0.50
nameserver 172.236.0.47
nameserver 172.236.0.53
nameserver 172.236.0.52
nameserver 172.236.0.45
nameserver 172.236.0.49
search members.linode.com ip.linodeusercontent.com

# Based on host file: '/run/systemd/resolve/resolv.conf' (legacy)
# Overrides: []

/etc/resolv.conf它与我的主机(Ubuntu 24.04)不同:

ll /etc/resolv.conf
lrwxrwxrwx 1 root root 37 Jan 23 18:19 /etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf
cat /etc/resolv.conf

nameserver 127.0.0.53
options edns0 trust-ad
search members.linode.com ip.linodeusercontent.com

但/run/systemd/resolve/resolv.conf在主机上匹配。

我不明白为什么resonv.conf我的主机上有两个不同的。

还不太清楚Docker 容器内的 DNS 是否配置正确。

编辑1

Docker容器中的路由:

ip route show
default via 172.17.0.1 dev eth0
172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.3

主机上的路由:

ip route show
default via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
172.18.0.0/16 dev br-7c0ebcfd4e3a proto kernel scope link src 172.18.0.1
172.20.0.0/16 dev br-99d8bde8e488 proto kernel scope link src 172.20.0.1
172.236.0.45 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.46 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.47 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.48 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.49 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.50 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.51 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.52 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.53 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.54 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.29.0/24 dev eth0 proto kernel scope link src 172.236.29.157 metric 1024
172.236.29.1 dev eth0 proto dhcp scope link src 172.236.29.157 metric 1024

从 Docker 容器中:

ping 91.189.91.82
PING 91.189.91.82 (91.189.91.82) 56(84) bytes of data.
64 bytes from 91.189.91.82: icmp_seq=1 ttl=47 time=82.5 ms
64 bytes from 91.189.91.82: icmp_seq=2 ttl=47 time=82.6 ms

telnet security.ubuntu.com 80
Trying 91.189.91.81...
Connected to security.ubuntu.com.
Escape character is '^]'.
^]
telnet> quit
Connection closed.

编辑2

从 Docker 容器中:

root@4e534b3b6847:/# apt install --no-cache linux-libc-dev
E: Command line option --no-cache is not understood in combination with the other options
root@4e534b3b6847:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
overlay          49G   34G   15G  70% /
tmpfs            64M     0   64M   0% /dev
shm              64M     0   64M   0% /dev/shm
/dev/sda         49G   34G   15G  70% /etc/hosts
tmpfs           985M     0  985M   0% /proc/acpi
tmpfs           985M     0  985M   0% /proc/scsi
tmpfs           985M     0  985M   0% /sys/firmware

root@4e534b3b6847:/# apt clean
root@4e534b3b6847:/# apt install linux-libc-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
linux-libc-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,769 kB of archives.
After this operation, 7,508 kB of additional disk space will be used.
Ign:1 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 linux-libc-dev amd64 6.8.0-51.52
Err:1 http://security.ubuntu.com/ubuntu noble-updates/main amd64 linux-libc-dev amd64 6.8.0-51.52
404  Not Found [IP: 185.125.190.82 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_6.8.0-51.52_amd64.deb  404  Not Found [IP: 185.125.190.82 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

编辑3

在主机上:

  $ apt-cache policy linux-libc-dev
  linux-libc-dev:
  Installed: 6.8.0-52.53
  Candidate: 6.8.0-52.53
  Version table:
  *** 6.8.0-52.53 500
        500 http://mirrors.linode.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
        100 /var/lib/dpkg/status
     6.8.0-31.31 500
        500 http://mirrors.linode.com/ubuntu noble/main amd64 Packages

在 Docker 容器中:

  # apt-cache policy linux-libc-dev
  linux-libc-dev:
  Installed: (none)
  Candidate: 6.8.0-51.52
  Version table:
     6.8.0-51.52 500
        500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
     6.8.0-31.31 500
        500 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages
domain-name-system
  • 1 1 个回答
  • 110 Views

1 个回答

  • Voted
  1. Best Answer
    thecarpy
    2025-01-30T14:21:36+08:002025-01-30T14:21:36+08:00

    当我昨天检查 repo 时,Packages.gz 的日期是 2025-01-29,今天它的日期是 2025-01-30 04:21。

    Gerald Schneider 成功了!您是 repo 更新的受害者。

    评论后更新:

    docker 从以前的构建中缓存,在这种情况下,缓存包含过时的数据。运行docker build --no-cache将忽略缓存。

    • 2

相关问题

  • Solaris DNS

  • resolv.conf 在经过一段时间后被更改

  • 为什么有些网站的网址中没有“www”就无法显示?[关闭]

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve