docker 无法执行systemctl:System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down

背景

System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down

解决办法

运行容器的时候加上参数--privileged 并且使用/usr/sbin/init 或者/sbin/init ,不要使用/bin/bash
例如debian系列(ubuntu、uos、deepin)
docker run -itd --privileged=true 容器id /sbin/init
例如redhat系列(centos)
docker run -itd --privileged=true 容器id /usr/sbin/init

进入容器依旧使用 /bin/bash

参考链接

https://www.yoyoask.com/?p=311

posted @   Tarzen  阅读(3247)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
历史上的今天:
2019-10-08 cassandra集群
点击右上角即可分享
微信分享提示