zl程序教程

您现在的位置是:首页 >  其他

当前栏目

docker容器内无法使用systemctl

2023-02-26 10:20:34 时间

问题:
在docker容器中使用systemctl命令报错

powershell [[email protected] /]# systemctl start nginx System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down   解决办法: 运行容器时添加`--privileged=true`,修改/bin/bash为/sbin/init [[email protected] ~]# docker run -itd --name nginxv2 --privileged=true centos /usr/sbin/init   验证: powershell [[email protected] ~]# docker exec -it nginxv2 /bin/bash [[email protected] /]# systemctl start nginx [[email protected] /]# ps -ef |grep nginx root         187       1  0 02:32 ?        00:00:00 nginx: master process /usr/sbin/nginx nginx        188     187  0 02:32 ?        00:00:00 nginx: worker process

docker容器内无法使用systemctl


本站部分内容转载自网络,版权属于原作者所有,如有异议请联系QQ153890879修改或删除,谢谢!
转载请注明原文链接:docker容器内无法使用systemctl

你还在原价购买阿里云、腾讯云、华为云、天翼云产品?那就亏大啦!现在申请成为四大品牌云厂商VIP用户,可以3折优惠价购买云服务器等云产品,并且可享四大云服务商产品终身VIP优惠价,还等什么?赶紧点击下面对应链接免费申请VIP客户吧:

1、点击这里立即申请成为腾讯云VIP客户

2、点击这里立即注册成为天翼云VIP客户

3、点击这里立即申请成为华为云VIP客户

4、点击这里立享阿里云产品终身VIP优惠价

喜欢 (0)
[[email protected]]
分享 (0)