System has not been booted with systemd as init system

 

在docker 容器裏使用systemctl命令報錯

如:systemctl start keepalived.service

問題原因:

我啓動centos容器的命令是:

docker run -d --name centos_1 -it  centos:latest /bin/bash

需要修改爲

docker run -tid --name centos_1 --privileged=true centos:latest /sbin/init

也就是加--privileged=true,修改/binbash  爲/sbin/init

修改後,就可以正常啓動服務了

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章