记一次 Docker 容器启动失败
情况是一台虚拟机上的达梦数据库连不上了,实际上也无法通过 SSH 连上虚拟机,尝试通过 VMWare 控制台重启服务器。
重启后,机器还是无法连接,扩大磁盘重启,勉强能连,但是很卡。后来这个事暂时搁置了。
到今天一看,机器能连了,而且很顺畅,尝试重启达梦数据库。结果失败:
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4311f58856b7 dm8:dm8_20240613_rev229704_x86_rh6_64 "/opt/startup.sh" 8 months ago Exited (255) 3 days ago 0.0.0.0:5236->5236/tcp dameng
[root@localhost ~]# docker start 4311f58856b7
Error response from daemon: oci runtime error: container_linux.go:300: starting container process caused "process_linux.go:255: applying cgroup configuration for process caused \"Failed to activate service 'org.freedesktop.systemd1': timed out\""
Error: failed to start containers: 4311f58856b7
似乎一些服务没有启动起来,导致容器启动失败。重启 docker 试试,结果发现停止 docker 后无法正常启动:
[root@localhost ~]# systemctl stop docker
Authorization not available. Check if polkit service is running or see debug message for more information.
[root@localhost ~]# systemctl start docker
Authorization not available. Check if polkit service is running or see debug message for more information.
Failed to start docker.service: 连接超时
See system logs and 'systemctl status docker.service' for details.
网上说可能是 polkit 服务没有启动,确实是没有启:
[root@localhost ~]# systemctl status polkit
● polkit.service - Authorization Manager
Loaded: loaded (/usr/lib/systemd/system/polkit.service; static; vendor preset: enabled)
Active: failed (Result: timeout) since 四 2025-03-27 19:44:55 CST; 3 days ago
Docs: man:polkit(8)
Process: 757 ExecStart=/usr/lib/polkit-1/polkitd --no-debug (code=killed, signal=TERM)
Main PID: 757 (code=killed, signal=TERM)
3 月 27 19:41:20 localhost.localdomain systemd[1]: Starting Authorization Manager...
3 月 27 19:43:51 localhost.localdomain polkitd[757]: Started polkitd version 0.112
3 月 27 19:44:44 localhost.localdomain systemd[1]: polkit.service start operation timed out. Terminating.
3 月 27 19:44:55 localhost.localdomain systemd[1]: Failed to start Authorization Manager.
3 月 27 19:44:55 localhost.localdomain systemd[1]: Unit polkit.service entered failed state.
3 月 27 19:44:55 localhost.localdomain systemd[1]: polkit.service failed.
尝试重启 polkit 服务,结果也没有启动起来:
[root@localhost ~]# systemctl start polkit
Authorization not available. Check if polkit service is running or see debug message for more information.
Failed to start polkit.service: 连接超时
See system logs and 'systemctl status polkit.service' for details.
最后通过reboot命令重启虚拟机,发现 polkit 正常,重启容器成功。
浙公网安备 33010602011771号