Failed to get D-Bus connection: Operation not permitted

centos7.4 在docker容器中启动php报错

报错:

[root@be474fdeb4d1 /]# systemctl start php
Failed to get D-Bus connection: Operation not permitted

原因:在centos7的docker容器里面不能用service启动服务。

报这个错的原因是dbus-daemon没能启动。systemctl并不是不能使用。将CMD或者entrypoint设置为/usr/sbin/init即可。docker容器会自动将dbus等服务启动起来。

解决方法:

docker run --privileged -it --name web centos:7.4.1708 /usr/sbin/init  #运行容器
xshell断开重连
docker exec -it  web /bin/bash      #进入容器
[root@0ff32a826787 /]# systemctl start php-fpm
[root@0ff32a826787 /]# systemctl enable php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.

转载于:https://www.cnblogs.com/lvhanzhi/p/11332438.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值