天天看点

CentOS7 1611 运行Docker 使用systemctl start httpd.service报错的解决过程

centos7 1611 运行docker 使用systemctl start httpd.service报错如下图

CentOS7 1611 运行Docker 使用systemctl start httpd.service报错的解决过程

报错信息:failed to get d-bus connection: operation no permitted

在运行时加上 --privileged选项仍然无济于事。

CentOS7 1611 运行Docker 使用systemctl start httpd.service报错的解决过程

有网友说dbus-daemon没能启动。systemctl并不是不能使用。将cmd或者entrypoint设置为/usr/sbin/init即可。docker容器会自动将dbus等服务启动起来。然而容器卡死了。

CentOS7 1611 运行Docker 使用systemctl start httpd.service报错的解决过程

baidu了一大圈崩溃了,后来尝试了一下-d参数,哈哈居然ok了。

CentOS7 1611 运行Docker 使用systemctl start httpd.service报错的解决过程

下图是外国友人提供的解决方案,挂载 /sys/fs/cgroup 目录到容器的 /sys/fs/cgroup 目录并配置只读权限,但是docker run 命令只能使用-d参数,不能使用-it参数,使用-it参数仍然会卡死。

CentOS7 1611 运行Docker 使用systemctl start httpd.service报错的解决过程