原因

docker run -it centos /bash/bin

在容器中安装服务

systemctl start xxx.service

报错

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

解决办法

docker run -itd   --privileged --name myCentos centos /usr/sbin/init

docker exec -it myCentos /bin/bash

在容器中安装服务启动systemctl start xxx.service没有问题

 原因就是: 默认情况下,在第一步执行的是 /bin/bash,而因为docker中的bug,无法使用systemctl

                  所以我们使用了 /usr/sbin/init 同时 --privileged 这样就能够使用systemctl了,但覆盖了默认的 /bin/bash

   因此我们如果想进入容器 就不能再使用 docker attach myCentos

    而只能使用  docker exec -it myCentos /bin/bash  因为 exec 可以让我们执行被覆盖掉的默认命令 /bin/bash

    同时 -it 也是必须的。

System has not been booted with systemd as init system (PID 1). Can‘t operat相关推荐

  1. 排障集锦:九九八十一难之第十八难!-----System has not been booted with systemd as init system (PID 1). Can‘t operat

    报错现象如下 System has not been booted with systemd as init system (PID 1). Can't operate. Failed to conn ...

  2. window10下WSL使用Ubuntu报错: System has not been booted with systemd as init system (PID 1). Can‘t operat

    用window10下WSL使用Ubuntu来用Docker 当我使用命令sudo systemctl start docker的时候报错: System has not been booted wit ...

  3. WSL 错误 System has not been booted with systemd as init system (PID 1). Can‘t operate

    描述 项目 描述 操作系统 Windows 10 专业版 版本 WSL 2 前情 在 适用与 Linux 的 Windows 的子系统(WSL) 默认情况下是无法使用 systemctl 命令,使用该 ...

  4. docker报错:System has not been booted with systemd as init system (PID 1). Can‘t operate.

    docker使用centos7命令 systemctl 报错 $ systemctl status firewalld System has not been booted with systemd ...

  5. win11安装的Ubuntu20.04子系统出现System has not been booted with systemd as init system (PID 1)问题的解决流程

    目录 一.前言 二.具体解决方法 第一步:切换root用户至自己账号 第二步:重新安装xrdp 第三步:重新配置端口并启动xrdp 第四步:打开远程连接窗口 第五步:点击连接,开始进入Linux子系统 ...

  6. Linux 系统服务管理器(初始化系统/init system) -- systemd 及命令 systemctl 的详细介绍

    文章目录 一.系统服务管理器 systemd (一)systemd 的特性 (二)systemd 与 传统 init 系统的区别 (三)systemd 的目录和文件 (四)systemd 的 Unit ...

  7. 浅析 Linux 初始化系统(系统服务管理和控制程序/init system) -- UpStart

    文章目录 一.Upstart 简介 (一)开发 Upstart 的缘由 (二)Upstart 的特点 二.Upstart 概念和术语 (一)Job (二)Job 生命周期 (三)事件 Event 1. ...

  8. Linux 及其它类 Unix 系统的系统服务管理和控制程序(初始化系统/init system)简单梳理

    文章目录 一.Linux 的启动过程 二.初始化程序 (一)System V init (二)Upstart init (三)systemd (四)Launchd (五)Epoch (六)Mudar ...

  9. Linux设置进程自启动(systemd,init)

    Linux设置进程自启动(systemd,init) 一.介绍   首先,你能来到这里说明你已经浏览了很多帖子,真正急切地渴望得到具体答案.话不多说,直接开始我们的正文吧!目前市面上各种发行版linu ...

最新文章

  1. 设计模式:外观模式(Facade)
  2. 数字信号处理学习笔记(二)|快速傅里叶变换
  3. MySQL怎么存base64编码_MySQL中如何将字符串转为base64编码?
  4. jQuery笔记总结
  5. 开源纯C#工控网关+组态软件(九)定制Visual Studio
  6. uniapptabbar的高度是多少_【报Bug】uniapp页面底部空出了tabBar的高度
  7. 如何自定义一个starter组件
  8. java输出csv文件在excel中显示乱码
  9. mysql 全文检索 教程_mysql怎么做全文检索
  10. 为什么自由职业受追捧?
  11. ElasticSearch 6.4.3 启动报错: [Cannot assign requested address: bind]
  12. 图像直方图及直方图均衡总结(一)经典方法(附matlab和opencv端算法实现)
  13. ZigBee-CC2530单片机 - 按键控制跑马灯的启停
  14. 什么叫操作系统啊 | 战术后仰
  15. office图标异常解决办法
  16. 关保条例发展历程解读
  17. python的30个编程技巧
  18. 从零实践强化学习之连续动作空间上求解RL(PARL)
  19. 什么是汽车公告?汽车公告主机厂要做什么?
  20. Dva.js 入门级教学文档-1

热门文章

  1. 两个字符串中最长公共单词 C语言
  2. 看完阿里p8整理的Spring Security应用到源码手册,豁然开朗
  3. 日志保存SD卡并上传服务器的工具类
  4. uniapp之adbWIFI调试
  5. 关于Java中Match类的appendReplacement()方法的一个坑{ character to be escaped }
  6. 酞菁铜磺酸(CuPcS),酞青铜相对分子质量|齐岳生物
  7. 3Dmax调整材质的纹理方向有哪些步骤
  8. 优秀公众号推荐 STM32与FPGA资料整理 windows小工具推荐
  9. MEMOS 服务及隐私协议
  10. 虎书学习笔记2:图形学基础数学(向量、点积、叉积、)