我收到以下错误:
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
当我昨天检查 repo 时,Packages.gz 的日期是 2025-01-29,今天它的日期是 2025-01-30 04:21。
Gerald Schneider 成功了!您是 repo 更新的受害者。
评论后更新:
docker 从以前的构建中缓存,在这种情况下,缓存包含过时的数据。运行
docker build --no-cache
将忽略缓存。