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.
Here is a good post which tries to root cause the issue you are facing.
Shorter way:
RUN printf '#!/bin/sh\nexit 0' > /usr/sbin/policy-rc.d
should resolve your issue
OR
If that doesn't resolve the issue, try running your docker container with privileged
option. Like this, docker run --privileged -d -ti DOCKER_IMAGE:TAG
Ideally, I would not recommend running container with privileged
option unless it's a test bed container. The reason being running a docker container with privileged gives all capabilities to the container, and it also lifts all the limitations enforced. In other words, the container can then do almost everything that the host can do. But this is not a good practice. This defeats the docker purpose of isolating from host machine.
The ideal way to do this is to set capabilities
of your docker container based on what you want to achieve. Googling this should help you out to provide appropriate capability
for your docker container.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With