在运行的docker容器中 执行命令启动nginx
[root@node132 ~]# docker run -it nginx-1 /bin/bash
[root@03e74fb601c1 /]# systemctl start nginx
Failed to get D-Bus connection: Operation not permitted
如果要是用systemctl 管理服务就要加上参数 --privileged 来增加权,并且不能使用默认的bash,换成 init,命令如下
[root@node132 ~]# docker run -d -it --privileged nginx-1 /usr/sbin/init