docker Failed to get D-Bus connection 报错
Posted 滴滴滴--你不是爱拖延,而是爱逃避
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker Failed to get D-Bus connection 报错相关的知识,希望对你有一定的参考价值。
docker Failed to get D-Bus connection 报错
在centos7的容器里面出现了一个BUG,就是serveice启动服务的时候出现报错,不能用service启动服务。
[[email protected] /]# service httpd start
Redirecting to /bin/systemctl start httpd.service
Failed to get D-Bus connection: Operation not permitted
首先恭喜你使用centos7镜像,然后就是不幸告诉你这个问题是个BUG 将在centos7.2解决。
Currently, systemd in CentOS 7 has been removed and replaced with a fakesystemd package for dependency resolution. This is due to systemd requiring the CAP_SYS_ADMIN capability, as well as being able to read the host‘s cgroups. If you wish to replace the fakesystemd package and use systemd normally, please follow the steps below.
我查了好多地方都说是个BUG不能解决
有的说创建的时候加上 --privileged选项
我试了这些然而并没有任何的卵用
最后实在是没办法就 rpm -ql 软件包 查看安装的时候有哪些命令在PATH下,用这些命令去启动,这个是一种解决的方法
例如apache的启动就是用命令 httpd
这几天研究了个解决的办法比较靠谱,亲身实测好使:
systemctl start http.service
Failed to get D-Bus connection: No connection to service manager.
这个的原因是因为dbus-daemon没能启动。其实systemctl并不是不可以使用。将你的CMD或者entrypoint设置为/usr/sbin/init即可。会自动将dbus等服务启动起来。
然后就可以使用systemctl了。命令如下:
docker run --privileged -ti -e "container=docker" -v /sys/fs/cgroup:/sys/fs/cgroup centos /usr/sbin/init
以上是关于docker Failed to get D-Bus connection 报错的主要内容,如果未能解决你的问题,请参考以下文章
Docker中启动mysql报错: Failed to get D-Bus connection
配置centos7解决 docker Failed to get D-Bus connection 报错
Docker CentOS Failed to get D-Bus connection: Operation not permitted
Docker创建容器报错:Failed to get D-Bus connection: Operation not permitted
Docker 解决Failed to get D-Bus connection: Operation not permitted(问题解决)
docker容器中启动service服务 Failed to get D-Bus connection: Operation not permitted