title: How to start apache2 automatically in a ubuntu docker container?
body: <p>I am trying to create a Dockerfile that will start apache automatically. Nothing has worked. But If I log into the container and run <code>service apache2 start</code> it works. Why can I not run that command from my Dockerfile?</p>
  
  <pre><code>FROM ubuntu
  
  # File Author / Maintainer
  MAINTAINER rmuktader
  
  # Update the repository sources list
  RUN apt-get update
  
  # Install and run apache
  RUN apt-get install -y apache2 &amp;&amp; apt-get clean
  
  #ENTRYPOINT ["/usr/sbin/apache2", "-k", "start"]
  
  
  #ENV APACHE_RUN_USER www-data
  #ENV APACHE_RUN_GROUP www-data
  #ENV APACHE_LOG_DIR /var/log/apache2
  
  EXPOSE 80
  CMD service apache2 start
  </code></pre>