Docker 解决 CentOS7 容器 Failed to get D-Bus connection: Operation not permitted

时间:2021-11-05 01:09:12

在执行systemctl httpd start时,出现错误:Failed to get D-Bus connection: Operation not permitted

原因:好像是因为dbus-daemon没能启动。

解决方法:

创建container时,在后面加上/usr/sbin/init:

docker run -d -e "container=docker" --privileged=true [ID] /usr/sbin/init

然后再进入container:

docker exec -it [Container ID] /bin/bash