zoukankan      html  css  js  c++  java
  • Docker容器里使用systemctl命令报错(System has not been booted with systemd as init system)

    起因是这样:我当前已进入Docker容器里面,在容器的操作系统(centos7)使用systemctl命令的时候,出错了,错误信息:System has not been booted with systemd as init system (PID 1). Can't operate.

    如:systemctl status keepalived

    问题原因:

    我启动centos容器的命令是:

    docker run -itd --name centos_java_nginx hejianliang/centos:java_nginx /bin/bash

    需要改为:

    docker run -itd --name centos_java_nginx --privileged=true hejianliang/centos:java_nginx /sbin/init

    在原命令上加了 --privileged=true,修改/binbash  为 /sbin/init (重点)

    修改过后,重新运行就可以在容器里正常使用systemctl命令了



  • 相关阅读:
    PHP添加Redis模块及连接
    Redis高级应用
    Redis常用命令
    Redis的数据类型及操作
    Redis下载及安装部署
    NoSQL介绍
    8种Nosql数据库系统对比
    JQ插件
    libcurl一般用法
    密钥对加密原理
  • 原文地址:https://www.cnblogs.com/hejianliang/p/13959650.html
Copyright © 2011-2022 走看看