docker centos中安装宝塔,使用systemctl 报错处理
准备用docker安装宝塔:docker run -itd -p 8888:8888 -p 80:80 --privileged=true --name=bt centos
结果systemctl命令报如下错误:
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
docker stop bt && docker rm bt 删除容器
重新建一个 docker run -itd -p 8888:8888 -p 80:80 --privileged=true --name=bt centos /usr/sbin/init
注意颜色部分,
这样创建的centos容器,无论是否重启都能正常使用systemctl命令了