title: Starting a service inside of a Dockerfile
body: <p>I'm building a Docker container and in this container I am downloading the Apache service.  Is it possible to automatically start the Apache service at some point?  Systemctl start httpd does not work inside of the Dockerfile.</p>
  
  <p>Basically, I want the apache service to be started when the docker container is started.</p>
  
  <pre><code>FROM centos:7
  MAINTAINER me &lt;me@me.com&gt;
  RUN yum update -y &amp;&amp; yum install -y httpd php
  RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
  rm -f /lib/systemd/system/multi-user.target.wants/*;\
  rm -f /etc/systemd/system/*.wants/*;\
  rm -f /lib/systemd/system/local-fs.target.wants/*; \
  rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
  rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
  rm -f /lib/systemd/system/basic.target.wants/*;\
  rm -f /lib/systemd/system/anaconda.target.wants/*;
  VOLUME [ "/sys/fs/cgroup" ]
  EXPOSE 80
  EXPOSE 443
  CMD ["/usr/sbin/init"]
  </code></pre>