centos7 docker容器报 docker Failed to get D-Bus connection 错误

来源:互联网 发布:linux 红色闪烁 编辑:程序博客网 时间:2024/05/29 07:22

在centos7的docker容器里面不能用service启动服务。


systemctl start httpd


报错内容:Failed to get D-Bus connection: Operation not permitted。

网上查询资料,说在docker run容器的时候加上 --privileged 参数,然而并无卵用。


报这个错的原因是dbus-daemon没能启动。systemctl并不是不能使用。将CMD或者entrypoint设置为/usr/sbin/init即可。docker容器会自动将dbus等服务启动起来。如下:


docker run --privileged -ti --name test  docker.io/centos:7  /usr/sbin/init

阅读全文
0 0