I have installed Docker 20.10 on RHEL 9 system, and installed CentOS 7 container on docker. But when I tried yum update
on it, it takes a long time while running transaction, as if yum stuck while updating.
Yum update
I tried strace -p 6351
to see what is happening inside yum, and it endlessly says fnctl(765158398, F_GETFD) = -1 EBADF (Bad File Descriptor)
strace -p 6351
Same thing happens when I tried yum install openssh-server
, but yum install telnet
worked fine.
I really want to know what is happening on my docker. Any idea to fix it??
2
Answers
After some research, I have found that
ulimit -n
,ulimit -Hn
,ulimit -Sn
value inside the container was 1073741824, and it made yum check every possible file descriptor, from 0 to 1073741824.I have inserted
--ulimit nofile=1024:262144
in docker commandline (likedocker run --ulimit nofile=1024:262144 --name test -p 2202:22/tcp -i -t centos:7 /bin/bash
), andyum update
worked fine! Now I can enjoy yum on docker happily!Is there also a solution without setting it in every docker container and maybe in containerd? I am experiencing similar issues in centos 7.9 containers running on centos 9 hosts using Kubernetes/containerd. Yum installations take hours instead of minutes.
Update: I’ve added LimitNOFILE=1048576 to the service unit of containerd now and it works.