Docker systemctl 不能使用

 

[root@93aba38c7427 /]# systemctl 
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时发现不能使用systemctl等命令。

解决方案:

sudo docker run -itd --dns 114.114.114.114  --dns 114.114.115.115  --publish 3380:80   --publish 3322:22   --name centos_xwds_02  --privileged=true   --restart always  --volume /etc/localtime:/etc/localtime   --volume  /mydata:/mydata centos:latest /sbin/init

添加 –privileged=true 初始化程序为/sbin/init