title: Docker container exits with code 0 after running composer install
body: <p>I have a docker file which looks like this:</p>
  
  <pre><code>FROM php:7.0-apache
  MAINTAINER "Moritz Buettner"
  
  RUN apt-get update &amp;&amp; apt-get install -y libpq-dev &gt;/dev/null 2&gt;&amp;1\
      &amp;&amp; docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql &gt;/dev/null 2&gt;&amp;1\
      &amp;&amp; docker-php-ext-install pdo pdo_pgsql pgsql mbstring &gt;/dev/null 2&gt;&amp;1
  
  RUN curl -sS https://getcomposer.org/installer | php \
        &amp;&amp; chmod +x composer.phar &amp;&amp; mv composer.phar /usr/local/bin/composer
  
  RUN apt-get install -y git &gt;/dev/null 2&gt;&amp;1
  RUN apt-get install -y zip &gt;/dev/null 2&gt;&amp;1
  RUN apt-get install -y unzip &gt;/dev/null 2&gt;&amp;1
  
  COPY api /var/www
  RUN a2enmod rewrite &amp;&amp; rm -r /var/www/html &amp;&amp; ln -sf /var/www/public /var/www/html
  RUN chmod -R 777 /var/www
  
  RUN mkdir -m 777 -p /var/www/public/export-files/csv
  
  CMD bash -c "cd /var/www &amp;&amp; composer install --prefer-dist --no-scripts --no-autoloader"
  </code></pre>
  
  <p>When building the image and running the container, composer installs everything as expected, but once it finished the container exits with code 0.</p>
  
  <p>Output of docker-compose up:</p>
  
  <pre><code>[... composer installing stuff ...]
  inventar-api | Generating autoload files
  inventar-api | &gt; Illuminate\Foundation\ComposerScripts::postInstall
  inventar-api | &gt; php artisan optimize
  inventar-api | Generating optimized class loader
  inventar-api | The compiled class file has been removed.
  inventar-api exited with code 0
  </code></pre>
  
  <p>then i tried to restart the container manually but it keeps shutting down instantly.</p>
  
  <p>Do you have an suggestion on why this happens?</p>
  
  <p>EDIT: Before adding composer to the docker file everything worked well.</p>