title: Docker COPY not updating files when rebuilding container
body: <p>I have a docker-compose-staging.yml file which I am using to define a PHP application. I have defined a data volume container (app) in which my application code lives, and is shared with other containers using volumes_from.</p>
  
  <p>docker-compose-staging.yml:</p>
  
  <pre><code>version: '2'
  services:
      nginx:
          build:
              context: ./
              dockerfile: docker/staging/nginx/Dockerfile
          ports:
              - 80:80
          links:
              - php
          volumes_from:
              - app
  
      php:
          build:
              context: ./
              dockerfile: docker/staging/php/Dockerfile
          expose:
              - 9000
          volumes_from:
              - app
  
      app:
          build:
              context: ./
              dockerfile: docker/staging/app/Dockerfile
          volumes:
              - /var/www/html
          entrypoint: /bin/bash
  </code></pre>
  
  <p>This particular docker-compose-staging.yml is used to deploy the application to a cloud provider (DigitalOcean), and the Dockerfile for the app container has COPY commands which copy over folders from the local directory to the volume defined in the config.</p>
  
  <p>docker/staging/app/Dockerfile:</p>
  
  <pre><code>FROM php:7.1-fpm
  COPY ./public /var/www/html/public
  COPY ./code /var/www/html/code
  </code></pre>
  
  <p>This works when I first build and deploy the application. The code in my public and code directories are present and correct on the remote server. I deploy using the following command:</p>
  
  <pre><code>docker-compose -f docker-compose-staging.yml up -d
  </code></pre>
  
  <p>However, next I try adding a file to my local public directory, then run the following command to rebuild the updated code:</p>
  
  <pre><code>docker-compose -f docker-compose-staging.yml build app
  </code></pre>
  
  <p>The output from this rebuild suggests that the COPY commands were successful:</p>
  
  <pre><code>Building app
  Step 1 : FROM php:7.1-fpm
   ---&gt; 6ed35665f88f
  Step 2 : COPY ./public /var/www/html/public
   ---&gt; 4df40d48e6a5
  Removing intermediate container 7c0fbbb7f8b6
  Step 3 : COPY ./code /var/www/html/code
   ---&gt; 643d8745a479
  Removing intermediate container cfb4f1a4f208
  Successfully built 643d8745a479
  </code></pre>
  
  <p>I then deploy using:</p>
  
  <pre><code>docker-compose -f docker-compose-staging.yml up -d
  </code></pre>
  
  <p>With the following output:</p>
  
  <pre><code>Recreating docker_app_1
  Recreating docker_php_1
  Recreating docker_nginx_1
  </code></pre>
  
  <p>However when I log into the remote containers, the file changes are not present.</p>
  
  <p>I'm relatively new to Docker so I'm not sure if I've misunderstood any part of this process! Any guidance would be appreciated.</p>