<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Rhel 9 on 认真的雪</title><link>https://blog.wjhe.top/tags/rhel-9/</link><description>Recent content in Rhel 9 on 认真的雪</description><generator>Hugo -- gohugo.io</generator><language>zh</language><lastBuildDate>Tue, 03 Feb 2026 10:02:00 +0800</lastBuildDate><atom:link href="https://blog.wjhe.top/tags/rhel-9/index.xml" rel="self" type="application/rss+xml"/><item><title>rhel 9 系统 Docker 运行 CentOS yum 命令卡死</title><link>https://blog.wjhe.top/rhel-9-%E7%B3%BB%E7%BB%9F-docker-%E8%BF%90%E8%A1%8C-centos-yum-%E5%91%BD%E4%BB%A4%E5%8D%A1%E6%AD%BB/</link><pubDate>Tue, 03 Feb 2026 10:02:00 +0800</pubDate><guid>https://blog.wjhe.top/rhel-9-%E7%B3%BB%E7%BB%9F-docker-%E8%BF%90%E8%A1%8C-centos-yum-%E5%91%BD%E4%BB%A4%E5%8D%A1%E6%AD%BB/</guid><description>&lt;p&gt;CentOS Stream 9、Rocky Linux 9 等 rhel 9 系统。在 Docker 容器的 CentOS7 镜像执行 yum 操作 特别慢。
是因为 open files 太大了。&lt;/p&gt;
&lt;p&gt;先查看之前的 ulimit&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker run -it --tty --network host --name centos7 centos:centos7.9.2009 /bin/bash
ulimit -a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;输出&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 30537
max locked memory (kbytes, -l) 8192
max memory size (kbytes, -m) unlimited
open files (-n) 1073741816
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;替换源&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;for f in /etc/yum.repos.d/*.repo
do
 mv -f &amp;#34;$f&amp;#34; &amp;#34;${f}.backup&amp;#34;
done
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.huaweicloud.com/artifactory/os-conf/centos/centos-7.repo

yum makecache -y 
yum update -y 
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;直接卡死在 &lt;code&gt;Updating : glibc-2.17-326.el7_9.3.x86_64&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;现在我们重新加上 ulimit&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker run -it --tty --network host --name centos7 --ulimit &amp;#34;nofile=1024:1048576&amp;#34; centos:centos7.9.2009 /bin/bash
ulimit -a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;输出&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 30537
max locked memory (kbytes, -l) 8192
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;执行上面的步骤，就不会卡死了。&lt;/p&gt;
&lt;p&gt;参考
&lt;a class="link" href="https://github.com/moby/moby/issues/45838" target="_blank" rel="noopener"
 &gt;https://github.com/moby/moby/issues/45838&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>