-------------------------------------------------------------------------------------------------

|  欢迎关注个人公众号  zclinux_note  第一时间获取关于linux使用的技巧。探索Linux的奥秘   |

-------------------------------------------------------------------------------------------------

在centos镜像中执行systemctl restart httpd 失败,提示

Failed to get D-Bus connection: Operation not permitted

原因在于

1.没有启动systemd进程

2.没有使用特权

执行下面的命令,即可解决上述1,2的问题

docker run -itd --privileged centos init

执行完成后,再执行失败的命令,即可成功

或者去容器里验证下是否启动成功,是否可以使用systemctl命令

docker exec -it 487acf4373bc /bin/bash

systemctl  restart httpd

ps -ef | grep http

root       3542      1  0 08:44 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     3543   3542  0 08:44 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     3544   3542  0 08:44 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     3545   3542  0 08:44 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     3546   3542  0 08:44 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     3547   3542  0 08:44 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
root       3549   3449  0 08:44 pts/1    00:00:00 grep --color=auto http

证明成功了

【Docker】Failed to get D-Bus connection: Operation not permitted解决的更多相关文章

  1. Failed to get D-Bus connection: Operation not permitted解决

    docker中安装centos无法使用systemctl命令管理进程,报以下错误: Failed to get D-Bus connection: Operation not permitted 原因 ...

  2. 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 ...

  3. Docker 运行容器 CentOS7 使用systemctl 启动报错 Failed to get D-Bus connection: Operation not permitted

    原系统:Centos 7 Docker 版本:1.12.6 操作:安装并运行 Tomcat 问题:在创建好容器之后,并且进入系统运行启动tomcat [root@cd11558d3a22 /]# sy ...

  4. Failed to get D-Bus connection: Operation not permitted

    通过centos7镜像创建了一个docker容器,并在容器中安装了一个apache服务,但是启动时发生如下报错 [root@1346963c2247 ~]# rpm -qa | grep httpdh ...

  5. rsync同步时出现rsync: failed to set times on “xxxx”: Operation not permitted

    今天在同步数据的时候提示rsync: failed to set times on “xxxx”: Operation not permitted,一般来说要不是服务器时间不对或者权限没有设置好,下面 ...

  6. class-dump 复制到/usr/bin目录不可写,Operation not permitted 解决办法

    许多升级了OSX 10.11的朋友在配置class-dump的时候,会发现书上推荐的class-dump存放目录/usr/bin不再可写,如下所示: Operation not permitted 把 ...

  7. 使用npm install报错-4048 operation not permitted解决

    刚刚使用npm install时一直报错-4048 operation not permitted,也尝试了多种方法,终于使问题得到解决,这里总结几种方法,先贴图: 一:权限问题 首先看到operat ...

  8. 使用npm install报错- operation not permitted解决

    原文:https://blog.csdn.net/weixin_41715295/article/details/79508104 这几天使用npm install时一直报错-4048 operati ...

  9. Centos D-Bus connection: Operation not permitted

    解决办法: 首先要先在后台启动一个 CentOS7 容器(注意不要少参数): docker run -d -e "container=docker" --privileged=tr ...

随机推荐

  1. gnuplot中的一些技巧

    http://blog.csdn.net/bill_chuang/article/details/18215051 一.基础篇: 1.plot命令 基本命令:plot {<ranges>} ...

  2. 一段小代码秒懂C++右值引用和RVO(返回值优化)的误区

    关于C++右值引用的参考文档里面有明确提到,右值引用可以延长临时变量的周期.如: std::string&& r3 = s1 + s1; // okay: rvalue referen ...

  3. 处理fMRI数据的一些常用Matlab命令

    背景 处理fMRI数据常常用到MATLAB,在此记录一些常用代码及功能. 1.读取原始DICOM数据 1-1 读入dicom图像并绘图: Image = dicomread('fMRI.dcm'); ...

  4. 网站开发学习Python实现-Django学习-自学注意(6.1.3)

    @ 目录 1.配置文件相关 2.应用创建相关 3.项目相关 4.模板相关 5.其他 关于作者 1.配置文件相关 1.可以更改时间,地区相关(国际化) 2.BASE_DIR很重要,一个工程要有很好的移植 ...

  5. 抢先看:笔者亲历的2020年中国.NET开发者大会活动纪实

    2020年中国.NET开发者大会活动纪实 1 2020年12月19日的苏州工业园区,天公作美,阳光明媚,气象迷人,正是一个搞事的好日子.在这里,数百名中国.NET开发者们汇聚一堂,怀揣着激情和梦想,一 ...

  6. 为什么 HashMap 的容量大小要设置为2的N次方?

    原文链接:https://www.changxuan.top/?p=1208 前两天,我在一位同学提交中看到了下面这样的一行代码,让我很是惊讶. Map<String, String> t ...

  7. Core3.0使用Swagger接口文档

    前言 此方法为百度搜索结果,原文链接找不到了 步骤 1.引用Nuget Swashbuckle.AspNetCore 2.Startup.cs配置 //注册swagger服务,定义1个或者多个swag ...

  8. npm 各种常用命令

    全局删除 node-gyp npm -g uninstall node-gyp 再次安装依赖 npm install 更改包内容后重建 npm rebuild 清除缓存 npm cache clean ...

  9. Java学习日报9.30

    ********************************** double类型精度问题 ********************************** 1 package test; 2 ...

  10. Vue利用v-for渲染时表单信息出不来

    今天在写项目时,Controller的值已经传入到html,但是利用vue进行渲染的时候就是出不来, 原因如下: 注意,in 之前的空格.