title: Running apache and cron in docker
body: <p>I understood there should be  only one process running on foreground in a docker container.  Is there any chance of running both apache and cron together in foreground? A quick search says there is something called supervisord to achieve this. But is there any other method using Entrypoint script or CMD?</p>
  
  <p>Here is my Dockerfile </p>
  
  <pre><code>FROM alpine:edge
  RUN  apk update &amp;&amp; apk upgrade
  RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" &gt;&gt; /etc/apk   /repositories
  RUN  apk add \
       bash \ 
       apache2 \
       php7-apache2 \
       php7 \
       curl \
       php7-mysqli \
       php7-pdo \
       php7-pdo_mysql
  
   RUN cp /usr/bin/php7 /usr/bin/php
   RUN mkdir /startup
   COPY script.sh /startup
   RUN chmod 755 /startup/script.sh
   ENTRYPOINT ["/startup/script.sh"]
  </code></pre>
  
  <p>The content of script.sh is pasted below </p>
  
  <pre><code>#!/bin/bash
  # start cron
  /usr/sbin/crond -f -l 8
  # start apache
  httpd -D FOREGROUND
  </code></pre>
  
  <p>When the docker is run with this image only crond is running and most interestingly when I kill the cron then apache starts and running in the foreground. </p>
  
  <p>I am using aws ecs ec2 to run the docker container using task definition and a service. </p>