Failed to get D-Bus connection: Operation not permitted
通过centos7镜像创建了一个docker容器,并在容器中安装了一个apache服务,但是启动时发生如下报错
[root@1346963c2247 ~]# rpm -qa | grep httpd
httpd-tools-2.4.6-45.el7.centos.4.x86_64
httpd-2.4.6-45.el7.centos.4.x86_64
[root@1346963c2247 ~]# systemctl start httpd
Failed to get D-Bus connection: Operation not permitted
出现此报错的原因网络上解释说这是centos7容器的一个BUG,就是会在systemctl 启动服务时出现报错,此BUG将在centos7.2中得到解决。
解决措施如下:
sudo docker run -it --privileged centos /usr/sbin/init 在启动docker容器时使用这种方式启动,使用中方式启动的弊端是等待过程可能要很长
# federico @ linux in ~ [15:30:07] C:1
$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b255e96e1160 centos "/usr/sbin/init" 22 minutes ago Up 16 minutes agitated_hypatia
48082e41ebc5 centos "/bin/bash" About an hour ago Up About an hour pensive_lamport
1346963c2247 centos "/bin/bash" About an hour ago Up About an hour drunk_panini
ecb92e4f8374 centos "/bin/bash" About an hour ago Up About an hour suspicious_thompson
# federico @ linux in ~ [15:30:12]
$ sudo docker stop b255e96e1160
b255e96e1160
# federico @ linux in ~ [15:32:14]
$ sudo docker start b255e96e1160
b255e96e1160
在实验过程中,我们可能不想浪费太多的时间,所以在这里我们打开一个新的终端将这个容器重启(关闭->打开)
# federico @ linux in ~ [15:33:10]
$ sudo docker exec -it b255e96e1160 /bin/bash
docker自1.3版本起,提供了一个更加方便的工具exec,可以直接在容器中运行命令,例如我们使用我们刚刚新建的容器直接运行一个/bin/bash终端
[root@b255e96e1160 ~]# yum -y install net-tools httpd vim
执行此命令安装我们所需的软件包
[root@b255e96e1160 ~]# systemctl start httpd
[root@b255e96e1160 ~]# netstat -antp | grep 80
tcp6 0 0 :::80 :::* LISTEN 139/httpd
[root@b255e96e1160 ~]# ps aux | grep httpd
root 139 0.0 0.0 221944 7488 ? Ss 07:39 0:00 /usr/sbin/httpd -DFOREGROUND
apache 140 0.0 0.0 221944 5900 ? S 07:39 0:00 /usr/sbin/httpd -DFOREGROUND
apache 141 0.0 0.0 221944 5900 ? S 07:39 0:00 /usr/sbin/httpd -DFOREGROUND
apache 142 0.0 0.0 221944 5900 ? S 07:39 0:00 /usr/sbin/httpd -DFOREGROUND
apache 143 0.0 0.0 221944 5900 ? S 07:39 0:00 /usr/sbin/httpd -DFOREGROUND
apache 144 0.0 0.0 221944 5900 ? S 07:39 0:00 /usr/sbin/httpd -DFOREGROUND
root 148 0.0 0.0 9040 804 ? S+ 07:40 0:00 grep --color=auto httpd
[root@b255e96e1160 ~]#
现在,我们遇到的问题已经得到了解决,但是笔者到现在还不知道有没有更好的办法,能够在不用新建容器的情况下解决此问题,如果有前辈了解,望不吝告知谢谢!
Failed to get D-Bus connection: Operation not permitted的更多相关文章
- Failed to get D-Bus connection: Operation not permitted解决
docker中安装centos无法使用systemctl命令管理进程,报以下错误: Failed to get D-Bus connection: Operation not permitted 原因 ...
- docker—tomcat 报错:Failed to get D-Bus connection: Operation not permitted
docker search centos 查系统镜像 docker pull docker.io/centos 进入容器 [root@git opt]# docker images REPOSIT ...
- Docker 运行容器 CentOS7 使用systemctl 启动报错 Failed to get D-Bus connection: Operation not permitted
原系统:Centos 7 Docker 版本:1.12.6 操作:安装并运行 Tomcat 问题:在创建好容器之后,并且进入系统运行启动tomcat [root@cd11558d3a22 /]# sy ...
- 【Docker】Failed to get D-Bus connection: Operation not permitted解决
------------------------------------------------------------------------------------------------- | ...
- rsync同步时出现rsync: failed to set times on “xxxx”: Operation not permitted
今天在同步数据的时候提示rsync: failed to set times on “xxxx”: Operation not permitted,一般来说要不是服务器时间不对或者权限没有设置好,下面 ...
- Centos D-Bus connection: Operation not permitted
解决办法: 首先要先在后台启动一个 CentOS7 容器(注意不要少参数): docker run -d -e "container=docker" --privileged=tr ...
- remount failed: Operation not permitted ,怎么办呢?
remount failed: Operation not permitted ,怎么办呢? 1. 确定是否正确连接手机了$ adb devices 2. 进入shell$ adb shell 3. ...
- zabbix: failed to accept an incoming connection
错误描述 查日志发现: failed to accept an incoming connection: connection from "192.168.186.132" rej ...
- 【openstack报错】【metadata问题】‘http://169.254.169.254/2009-04-04/meta-data/instance-id’ failed : url error [[Errno 111] Connection refused]
[时间]2014年2月25日 [平台]ubuntu 12.04.3 openstack havana with nova-network in multi-host [日志]实例启动时输出的日志内容 ...
随机推荐
- MVVM 的理解
MVVM 是 Model - View - ViewModel 的缩写 可以看到他和之前的MVC很像,的确有人称之为一个加强优化版的MVC. 是一种模块化开发代码分层的思想或者框架! MVVM 的优点 ...
- Python bin() 函数
Python bin() 函数 Python 内置函数 描述 bin() 返回一个整数 int 或者长整数 long int 的二进制表示. 语法 以下是 bin() 方法的语法: bin(x) 参 ...
- C++强制转换
static_cast,dynamic_cast, const_cast, reinterpret_cast dynamic_cast比static_cast多了安全检测,判断源和目标有无继承被继承关 ...
- [leetcode]560. Subarray Sum Equals K 和为K的子数组
Given an array of integers and an integer k, you need to find the total number of continuous subarra ...
- C#6.0新特性:var s = $"{12}+{23}={12+23}"
为什么会出现$符号,c#6.0才出现的新特性 var s = string.Fromat("{0}+{1}={2}",12,23,12+23) 用起来必须输入string.From ...
- g++报错原因分析:expected class-name before ‘{’ token
今天写程序的时候, 遇到这样一个错误expected class-name before ‘{’ token 最后发现原来是我的头文件声明没有加. 继承时不要忘记加基类的头文件 错误: class F ...
- swift 设置string 中汉字中变色等处理代码
我们在做弹窗 或者显示label string的时候经常会用到字体变色 变大 等特殊处理, swift中提供一个函数 NSMutableAttributedString 使用方法简介 var main ...
- asp.net core 视图组件化
视图组件可以通过partial view或viewcomponent实现 partialview https://docs.microsoft.com/zh-cn/aspnet/core/mvc/vi ...
- 重新学习pytorch的库函数等..
http://blog.csdn.net/victoriaw/article/list/10 开始第一篇: http://blog.csdn.net/VictoriaW/article/details ...
- 2018.10.23 NOIP模拟 “新”的家园(缩图+dijksta/spfa)
传送门 考试70分骗分写挂了=30分=全场最低. 哎今天230垫底了. 这题出的挺好. 对于非关键点直接缩点. 每次把要查的insertinsertinsert进缩好的图里面跑spfa/dijkstr ...