Docker容器执行apt-get update出现404错误的原因排查
问题场景
使用php:5.5.38-apache Docker镜像,进入容器执行apt-get update时返回大量404 Not Found错误,容器网络连通性正常(可ping通google.com)。
apt-get update错误日志
# apt-get update Ign http://security.debian.org jessie/updates InRelease Ign http://security.debian.org jessie/updates Release.gpg Ign http://httpredir.debian.org jessie InRelease Ign http://security.debian.org jessie/updates Release Ign http://httpredir.debian.org jessie-updates InRelease Err http://security.debian.org jessie/updates/main amd64 Packages Ign http://httpredir.debian.org jessie Release.gpg Ign http://httpredir.debian.org jessie-updates Release.gpg Err http://security.debian.org jessie/updates/main amd64 Packages Ign http://httpredir.debian.org jessie Release Err http://security.debian.org jessie/updates/main amd64 Packages Ign http://httpredir.debian.org jessie-updates Release Err http://security.debian.org jessie/updates/main amd64 Packages Err http://security.debian.org jessie/updates/main amd64 Packages 404 Not Found [IP: 151.101.130.132 80] Err http://httpredir.debian.org jessie/main amd64 Packages 404 Not Found Err http://httpredir.debian.org jessie-updates/main amd64 Packages 404 Not Found W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages 404 Not Found [IP: 151.101.130.132 80] W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/main/binary-amd64/Packages 404 Not Found W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages 404 Not Found E: Some index files failed to download. They have been ignored, or old ones used instead.
网络连通性测试结果
# ping google.com PING google.com (142.250.187.206): 56 data bytes 64 bytes from 142.250.187.206: icmp_seq=0 ttl=37 time=58.393 ms 64 bytes from 142.250.187.206: icmp_seq=1 ttl=37 time=22.499 ms 64 bytes from 142.250.187.206: icmp_seq=2 ttl=37 time=21.658 ms ...
问题原因
- Debian Jessie已停止官方支持:Debian 8(Jessie)在2020年6月结束长期支持,官方软件源
httpredir.debian.org和security.debian.org已移除该版本的软件包索引,导致请求返回404。 - 镜像依赖的系统和软件版本过旧:
php:5.5.38-apache基于Debian Jessie构建,而PHP 5.5本身也早已停止维护,镜像内默认配置的软件源指向已下线的官方地址。
内容的提问来源于stack exchange,提问作者Martyn
相关产品推荐
相关产品推荐

