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


相关文章
|
弹性计算 安全 Ubuntu
docker启动容器提示read init-p: connection reset by peer: unknown问题
docker启动容器提示read init-p: connection reset by peer: unknown问题
|
Linux Docker Windows
docker pull 报错解决:error pulling image configuration: Get https:..
docker pull 报错解决:error pulling image configuration: Get https:..
4817 0
|
网络协议 网络安全 Docker
Docker Swarm 解决报错Error response from daemon: rpc error: code = Unavailable desc = connection error:
本文是博主学习docker swarm遇到的问题记录,希望对大家有所帮助。
2525 0
Docker Swarm 解决报错Error response from daemon: rpc error: code = Unavailable desc = connection error:
|
关系型数据库 MySQL Docker
docker pull mysql:8.0.26提示Error response from daemon: Get “https://registry-1.docker.io/v2/“: EOF错误
docker pull mysql:8.0.26提示Error response from daemon: Get “https://registry-1.docker.io/v2/“: EOF错误
5132 9
|
网络协议 jenkins 持续交付
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker
5966 0
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker
|
缓存 Kubernetes 应用服务中间件
1分钟了解什么是docker和docker-compose?前后端必知必会技能GET啦
1分钟了解什么是docker和docker-compose?前后端必知必会技能GET啦
|
网络协议 C++ Docker
Docker pull拉取镜像报错“Error response from daemon: Get "https://registry-1.docker.io/v2”解决办法
Docker pull拉取镜像报错“Error response from daemon: Get "https://registry-1.docker.io/v2”解决办法
72049 2
|
Linux Shell Docker
Docker容器使用问题:Failed to get D-Bus connection: Operation not permitted
Docker容器使用问题:Failed to get D-Bus connection: Operation not permitted