title: Docker container exiting immediately after running php code
body: <p>I'm currently developing a RESTful API with the Slim framework and I'm trying to run it on a docker container. The problem, however, is that the script runs only once and than automatically exits from docker with the exit code 0, i.e. it catches the first http request for the index.php page, returns it and then it exits.</p>
  
  <p>I'm sure, there must be a way to run apache on a container, so that every time I make a request for a specific URL(like localhost:8080/api/something) on my local browser, so that the apache server that is running in the container would handle those requests. However, since I didn't have any previous experience with docker, I'm currently not able to solve this.</p>
  
  <p>Here's my Dockerfile:</p>
  
  <pre><code>FROM php:7.0-cli
  COPY . /usr/src/my_app
  WORKDIR /usr/src/my_app/public
  CMD [ "php", "./index.php" ]
  </code></pre>
  
  <p>Here's my Docker-compose file:</p>
  
  <pre><code>version: '2'
  
  services:
     app:
        build: ./app
        volumes:
           - ./app:/usr/src/app
        ports:
           - 5001:80
  </code></pre>
  
  <p>Can someone tell my how to change my Dockerfile or Docker-compose file, so that the apache server does not exits after the first requests, but it still runs and listens for other requests.</p>
  
  <p>Thank you in advance!</p>