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

在docker容器内无法启动相应的服务
例如:

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

根本原因在于咩有启动dbus服务,所有需要在启动容器时,启动dbus服务,
例如:

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

返回结果如下:

[  OK  ] Stopped Getty on tty1.
[  OK  ] Started Getty on tty1.
[ TIME ] Timed out waiting for device dev-ttyS0.device.
[DEPEND] Dependency failed for Serial Getty on ttyS0.
[  OK  ] Reached target Login Prompts.
[  OK  ] Reached target Multi-User System.
         Starting Update UTMP about System Runlevel Changes...
[  OK  ] Started Update UTMP about System Runlevel Changes.

你可能感兴趣的:(docker,dbus,docker,service,systemctl)