Apache not running automatically on docker compose up
<p><strong>Dockerfile</strong></p>

<pre><code>FROM phusion/baseimage:0.9.16
MAINTAINER Raheel &lt;raheelwp@gmail.com&gt;

# Apache
RUN apt-get update
RUN apt-get -y install apache2

# PHP
RUN apt-get -y install python-software-properties
RUN add-apt-repository ppa:ondrej/php
RUN apt-get update
RUN apt-get -y install php7.0
RUN apt-get -y install libapache2-mod-php7.0 php7.0-curl php7.0-json

CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
</code></pre>

<p><strong>docker-composer.yaml</strong></p>

<pre><code>version: '2'
services:
  frontend:
    build: ./frontend
    ports:
     - "80:80"
    volumes:
     - ./frontend:/var/www/html/frontend
</code></pre>

<p>I am trying to run my laravel app inside docker. I am facing two problems </p>

<p>1 - When i run docker-compose up, the apache server inside the container doesnot start automatically. Everytime i have to login into the container and do <code>service apache2 start</code>. As per my searching i found the CMD command i wrote in the Dockerfile is how we start apache but not working in my case</p>

<p>2 - When i login to container and go to my app folder <code>/var/www/html/frontend</code> its user are 1000:1000 something. I want them to be under www-data:www-data. But i do not want this to be added in my Dockerfile since i want to keep my dockerfile only for installing apache and php. How can i achieve this by using <code>docker-compose.yaml</code> or any other way.</p>

<p><strong>Updated : Docker Container Logs</strong></p>

<pre><code>*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 9
Jul 10 08:27:33 6d5c09e83a98 syslog-ng[15]: syslog-ng starting up; version='3.5.3'
</code></pre>

<p>Thanks</p>