ubuntu22.04服务器在使用docker过程中,发现服务器重启或者docker服务重启,所有容器都没法启动,手动启动发现如下,报错信息
容器启动报错applying cgroup configuration for process caused mount point for devices not found
现将处理过程记录下
编写修复脚本:cgroup.sh
#!/bin/bash
if test ! -r "/etc/rc.local"; then
sudo sh -c 'echo "#!/bin/bash" >/etc/rc.local'
fi
if test -z "$(grep 'mkdir /sys/fs/cgroup/systemd && mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd' /etc/rc.local)"
then
sudo sh -c 'echo "mkdir /sys/fs/cgroup/systemd && mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd" >> /etc/rc.local'
fi
sudo cp -f init/autorun/rc-local.service /lib/systemd/system/rc-local.service
sudo chmod +x /etc/rc.local
sudo systemctl enable rc-local.service
sudo systemctl start rc-local.service
执行脚本: bash cgroup.sh
重启docker服务: systemctl restart docker