docker报错:System has not been booted with systemd as init system (PID 1). Can‘t operate.

时间:2022-12-26 22:00:16

docker使用centos7命令 systemctl 报错

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

解决方式

# 运行centos
# docker run -itd --name centos centos /bin/bash

# 替换为:
# 获取systemctl权限
docker run --privileged -itd --name centos centos /usr/sbin/init

# 进入终端
docker exec -it centos /bin/bash

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