Temporary failure resolving ‘security.ubuntu.com‘

apt-get update 的时候出现:

复制代码
Temporary failure resolving 'security.ubuntu.com'
Temporary failure resolving 'archive.ubuntu.com'

具体信息:

复制代码
 => ERROR [devel  3/17] RUN bash ./install_base.sh 3.12.3 && rm install_base.sh                                                                                                         242.3s
------                                                                                                                                                                                         
 > [devel  3/17] RUN bash ./install_base.sh 3.12.3 && rm install_base.sh:                                                                                                                      
#11 1.527 + GITHUB_URL=https://github.com                                                                                                                                                      
#11 1.527 + '[' -n '' ']'                                                                                                                                                                      
#11 1.529 ++ grep -oP '(?<=^ID=).+' /etc/os-release                                                                                                                                            
#11 1.530 ++ tr -d '"'                                                                                                                                                                         
#11 1.539 + ID=ubuntu
#11 1.539 + set_bash_env
#11 1.539 + '[' '!' -f /etc/bash.bashrc ']'
#11 1.539 + '[' '!' -f /etc/shinit_v2 ']'
#11 1.539 + case "$ID" in
#11 1.539 + init_ubuntu
#11 1.539 + apt-get update
#11 21.95 Ign:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
#11 21.95 Ign:2 http://archive.ubuntu.com/ubuntu jammy InRelease
#11 41.97 Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
#11 42.97 Ign:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
#11 61.99 Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
#11 65.00 Ign:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
#11 82.01 Ign:2 http://archive.ubuntu.com/ubuntu jammy InRelease
#11 89.02 Err:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
#11 89.02   Temporary failure resolving 'security.ubuntu.com'
#11 102.0 Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
#11 122.1 Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
#11 142.1 Ign:2 http://archive.ubuntu.com/ubuntu jammy InRelease
#11 162.1 Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
#11 182.1 Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
#11 202.1 Err:2 http://archive.ubuntu.com/ubuntu jammy InRelease
#11 202.1   Temporary failure resolving 'archive.ubuntu.com'
#11 222.2 Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
#11 222.2   Temporary failure resolving 'archive.ubuntu.com'
#11 242.2 Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
#11 242.2   Temporary failure resolving 'archive.ubuntu.com'
#11 242.2 Reading package lists...
#11 242.3 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease  Temporary failure resolving 'archive.ubuntu.com'
#11 242.3 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
#11 242.3 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
#11 242.3 W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
#11 242.3 W: Some index files failed to download. They have been ignored, or old ones used instead.
#11 242.3 E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
#11 242.3 E: Sub-process returned an error code

先看看主机的网:

shell 复制代码
ping -c 4 8.8.8.8

如果 ping 成功,说明网络连接正常,可以继续排查 DNS 问题。

如果 ping 不通,说明网络有问题,检查网络配置(如虚拟机网络、Docker 网络或代理设置)。

问题通常与 DNS 解析失败有关,手动设置 DNS 服务器: 编辑 /etc/resolv.conf 文件,添加以下内容:

shell 复制代码
nameserver 8.8.8.8
nameserver 8.8.4.4

验证 DNS 是否生效: 尝试 ping 或解析一个域名:

shell 复制代码
nslookup archive.ubuntu.com
ping archive.ubuntu.com
相关推荐
周之鸥11 分钟前
从零部署 Astro 静态网站到云服务器(含 HTTPS 一键配置)
运维·服务器·ubuntu·http·https·astro
林开落L18 分钟前
线程进阶:线程池、单例模式与线程安全深度解析
linux·安全·单例模式·线程池
Microsoft Word23 分钟前
跨平台向量库:Linux & Windows 上一条龙部署 PostgreSQL 向量扩展
linux·windows·postgresql
noravinsc1 小时前
centos如何做的时间同步
linux·运维·centos
迎風吹頭髮2 小时前
Linux内核架构浅谈25-Linux实时调度器:SCHED_RR与SCHED_FIFO策略实现
linux·运维·架构
vortex53 小时前
建立本地 APT 仓库教程
linux·运维开发
中草药z4 小时前
【Docker】零基础上手:原理+Ubuntu/Windows GUI 安装 + 镜像源 / 目录优化
运维·ubuntu·docker·容器·gui·安装·cgroups
ZhiqianXia4 小时前
BUG() 和 BUG_ON()
linux
jerryinwuhan5 小时前
LINUX复习资料(二)
linux·运维·服务器
郝学胜-神的一滴5 小时前
Linux下的阻塞与非阻塞模式详解
linux·服务器·开发语言·c++·程序人生·软件工程