docker Failed to get D-Bus connection 报错

简介:

在centos7的容器里面出现了一个BUG,就是serveice启动服务的时候出现报错,不能用service启动服务。
[root@e13c3d3802d0 /]# 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
  

wKioL1aYZnmScBPBAACZceqF4D8620.png  

  轻松无压力解决

本文转自    憬薇   51CTO博客,原文链接:http://blog.51cto.com/welcomeweb/1735251


相关文章
|
3月前
|
安全 Linux 数据安全/隐私保护
docker运行报错docker: Error response from daemon: AppArmor enabled on system but the docker-default prof
docker运行报错docker: Error response from daemon: AppArmor enabled on system but the docker-default prof
69 0
|
弹性计算 安全 Ubuntu
docker启动容器提示read init-p: connection reset by peer: unknown问题
docker启动容器提示read init-p: connection reset by peer: unknown问题
|
5月前
|
Docker 容器
error during connect: this error may indicate that the docker daemon is not running
error during connect: this error may indicate that the docker daemon is not running
143 0
|
4月前
|
Docker 容器
Docker服务启动失败报错:Job for docker.service failed because the control process exited with error code.
Docker服务启动失败报错:Job for docker.service failed because the control process exited with error code.
|
11月前
|
Docker 容器
docker: Error response from daemon: driver failed programming external connectivity on endpoint mysq
docker: Error response from daemon: driver failed programming external connectivity on endpoint mysq
|
网络协议 网络安全 Docker
Docker Swarm 解决报错Error response from daemon: rpc error: code = Unavailable desc = connection error:
本文是博主学习docker swarm遇到的问题记录,希望对大家有所帮助。
1217 0
Docker Swarm 解决报错Error response from daemon: rpc error: code = Unavailable desc = connection error:
|
8月前
|
并行计算 Docker 容器
docker: Error response from daemon: Unknown runtime specified nvidia. See ‘docker run --help‘.报错的解决
docker: Error response from daemon: Unknown runtime specified nvidia. See ‘docker run --help‘.报错的解决
125 0
|
8月前
|
Nacos Docker 容器
解决docker启动时报‘Error response from daemon: network xxx not found‘问题
解决docker启动时报‘Error response from daemon: network xxx not found‘问题
1201 0
|
9月前
|
iOS开发 Docker MacOS
【已解决】Docker Desktop “Fatal Error: exit status 1“
【已解决】Docker Desktop “Fatal Error: exit status 1“
183 0
|
10月前
|
Docker 容器
docker 内执行 systemctl 报错 解决方案: Failed to get D-Bus connection: Operation not permitted
docker 内部安装 systemctl 工具包的路径非系统路径,拷贝到系统路径 /bin/ 目录下,并且给执行权限即可
289 1