'How to solve "invoke-rc.d: policy-rc.d denied execution of start." when building a container Ubuntu 14.04 and installing apache2?

I am trying to install apache2 after a building image process. This is the code I am using in the Dockerfile.

FROM ubuntu:14.04
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

ENV DEBIAN_FRONTEND noninteractive

RUN sudo apt-get update
RUN sudo apt-get install -y apache2

After the process I get the apache installed but I get the follow error (red display in terminal)

...
invoke-rc.d: policy-rc.d denied execution of start.
...

How to solve that issue? If it is an issue.



Solution 1:[1]

worked for me after adding in Dockerfile:

RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d

invoke-rc.d: could not determine current runlevel

  • Starting NTP server ntpd ...done.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user19164601