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

|  欢迎关注个人公众号  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. 关于 SFML 在 Visual Studio下的环境搭建

    SFML 全称 Simple and Fast Multimedia Library,它是一个开放源代码,跨平台,支持多种编程语言绑定,并且提供简单易用的接口,用于多媒体程序和游戏开发,是替代SDL的 ...

  2. 1.pipeline原理

    redis基本语法:https://www.cnblogs.com/xiaonq/p/7919111.html redis四篇:https://www.cnblogs.com/xiaonq/categ ...

  3. Consul安装部署(Windows单机、Docker集群)

    1. Consul简介   Consul 是一个支持多数据中心分布式高可用的服务发现和配置共享的服务软件,由 HashiCorp 公司用 Go 语言开发,基于 Mozilla Public Licen ...

  4. springmvc中使用文件下载功能

    项目代码:https://github.com/PeiranZhang/springmvc-fileupload 使用文件下载步骤 对请求处理方法使用void或null作为返回类型,并在方法中添加Ht ...

  5. html2canvas实现浏览器截图的原理(包含源码分析的通用方法)

    DevUI是一支兼具设计视角和工程视角的团队,服务于华为云DevCloud平台和华为内部数个中后台系统,服务于设计师和前端工程师. 官方网站:devui.design Ng组件库:ng-devui(欢 ...

  6. 部署docker镜像仓库及高可用

      下载地址: https://github.com/goharbor/harbor/releases   安装harbor服务器: 安装harbor root@harbor-vm1:/usr/loc ...

  7. JavaScript之函数原型链完整版

    我的上一篇文章有解释绅士原型及简单的原型链,在这里我将对原型链做完整讲述: // 函数的原型链: 把函数当对象(实例对象)来看 function Person(){} // 底层Function创建出 ...

  8. 利用xlutils第三方库复制excel模板

    Python之利用第三方库套用excel模板,模板的样子假设如下: 现在要用这个模板,并且在"第二行第二列"的下方填入内容: #!usr/bin/python3 # -*-codi ...

  9. Python操作PDF-文本和图片提取(使用PyPDF2和PyMuPDF)

    PDF文件格式 如今,可移植文档格式(PDF)属于最常用的数据格式.在1990年,PDF文档的结构由Adobe定义.PDF格式的思想是,对于通信过程中涉及的双方(创建者,作者或发送者以及接收者)而言, ...

  10. 如何用tep完成增删改查接口自动化

    tep的设计理念是让人人都可以用Python写自动化,本文就来介绍如何用tep完成增删改查接口自动化. 环境变量 编辑fixtures/fixture_admin.py: "qa" ...