版本信息:
root@deepin:~# docker --version Docker version 18.09.6, build 481bc77
root@deepin:~# docker run -dit --name test centos /usr/sbin/init 在容器内启动apache [root@8065435580b6 ~]# systemctl start httpd Failed to get D-Bus connection: Operation not permitted
以前遇到这个报错,是通过docker run创建容器时执行 /usr/sbin/init 这个命令解决,现在发现也不好用了,还需要加上–privileged=true
root@deepin:~# docker run -dit --name test --privileged=true centos /usr/sbin/init
安装apache再用systemctl启动测试:
[root@7e43e6387f93 /]# systemctl start httpd [root@7e43e6387f93 /]# netstat -tnlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2421/httpd
原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/4467.html