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

|  欢迎关注个人公众号  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. sqli-labs less5-6(双查询注入)

    less-5 双查询注入 利用count(), group by, floor(), rand()报错 双查询注入的原理参考博客 打开less-5 用union注入的流程进行发现页面不会有回显,所以u ...

  2. 基于WSL2 的 Docker Desktop 启动时 Failed to set version to docker-desktop: exit code: -1的解决方法

    在Windows 10 的 2004 版本  中, 启用 使用Docker Desktop 时 发现  根本无法启动, 偶尔 或者频繁的出错: System.InvalidOperationExcep ...

  3. gnuplot取消曲线标题

    plot 'File.dat' using 1:2 notitle或者 plot 'File.dat' using 1:2 title ""

  4. Unity 3D里相机的平滑跟随(转)

    1 using System.Collections; 2 using System.Collections.Generic; 3 using UnityEngine; 4 public class ...

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

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

  6. Impala的特点

    Impala的特点 0. 原理 基于内存的分析框架. 1.为什么会有Impala? hive进行计算太慢了,于是就有了Impala,Impala可以理解为是hive的内存版本. 2.Impala的优点 ...

  7. matplotlib的学习8-scatter散点图

    import matplotlib.pyplot as plt import numpy as np n = 1024 # data size #生成1024个呈标准正太分布的二维数组(平均数为0,方 ...

  8. burpsuite进阶使用

    .Burpsuite:爆破 个人建议选择pro破解版的,免费版的太鸡肋,爆破不能设置线程,速度超乎你想像 浏览器和burpsuite设置代理后,开启抓包,截获数据包后,右键选择发送到repeater修 ...

  9. php 文件上传错误

    假设文件上传字段的名称img,则: $_FILES['img']['error']有以下几种类型 1.UPLOAD_ERR_OK 其值为 0,没有错误发生,文件上传成功. 2.UPLOAD_ERR_I ...

  10. hugging face-基于pytorch-bert的中文文本分类

    1.安装hugging face的transformers pip install transformers 2.下载相关文件 字表: wget http://52.216.242.246/model ...