title: docker-compose build and docker build giving different results
body: <p>I have created a simple Dockerfile to install apache with PHP and then install packages from composer.json.</p>
  <pre><code>FROM php:7-apache
  
  WORKDIR /var/www/html
  
  COPY ./src/html/ .
  COPY composer.json .
  
  RUN apt-get update
  RUN apt-get install -y unzip
  
  # Install Composer
  RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  
  RUN composer update
  
  </code></pre>
  <p>When I run <code>docker build -t my-web-server .</code> followed by <code>docker run -p 8080:80 my-web-server</code>, everything works fine and the packages install.</p>
  <p>But when I use a docker-compose file:</p>
  <pre class="lang-yaml prettyprint-override"><code>version: &quot;3.9&quot;
  services:
    ecp:
      build: .
      ports:
        - &quot;8080:80&quot;
      volumes:
        - ./src:/var/www
  </code></pre>
  <p>and perform <code>docker-compose build</code> followed by <code>docker-compose up</code> The packages do not install and I just index.php is taken across to the container</p>
  <p>my current file structure:</p>
  <pre><code>src
   |-- html
       |-- index.php
  composer.json
  docker-compose.yaml
  Dockerfile
  </code></pre>
  <p>When <code>docker-compose</code> is building the image all the console outputs are identical to that of <code>docker build</code></p>