原文:http://askubuntu.com/questions/365911/why-the-services-do-not-start-at-installation

大多数发行版不会包含 /usr/sbin/policy-rc.d 文件,因为这个文件是用于帮助管理员控制哪些包可以在安装、卸载、更新时执行脚本。

而在 docker 容器中,大多数 apt-get install 发生在 docker build 阶段,这个阶段如果去启动/停止服务,可能因为一些意外而无法成功并且也没有必要。大多数服务都是在 docker run 或 docker start 时启动/停止。

如果你一定要启动/停止服务,可以将 /usr/sbin/policy-rc.d 文件中的返回值改为0。

0 - action allowed
1 - unknown action (therefore, undefined policy)
100 - unknown initscript id
101 - action forbidden by policy
102 - subsystem error
103 - syntax error
104 - [reserved]
105 - behaviour uncertain, policy undefined.
106 - action not allowed. Use the returned fallback actions
(which are implied to be “allowed”) instead.

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐