Docker容器systemctl启动服务报错Failed to get D-Bus connection: Operation not permitted

Posted 闭关苦炼内功

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker容器systemctl启动服务报错Failed to get D-Bus connection: Operation not permitted相关的知识,希望对你有一定的参考价值。

解决办法:

创建容器时加上 --privileged=true

docker run -d -name c7-1 --privileged=true centos:7 /usr/sbin/init

进入容器:

docker exec -it c7-1 /bin/bash

by doing this …

就可以在容器中使用 systemctl 启动服务了

以上是关于Docker容器systemctl启动服务报错Failed to get D-Bus connection: Operation not permitted的主要内容,如果未能解决你的问题,请参考以下文章