title: I want to share code content across several containers using docker-compose volume directive
body: <p>I have a PHP application that I need to containerize. I am setting up the following:</p>
  
  <ol>
  <li>container for varnish </li>
  <li>container for nginx </li>
  <li>container for php-fpm</li>
  <li>container for cron </li>
  <li>container for tooling</li>
  <li>container with PHP code baked into</li>
  </ol>
  
  <p>Container 2,3,4,5 all need to have access to the same PHP application codebase that is baked into container 6.</p>
  
  <p>I would like to set this up to be able to revert to previous releases for the application by just changing the version tag of the codebase container.</p>
  
  <p>My current composer file is something like -></p>
  
  <pre><code>version "3"
  services:
    web:
     image:nginx
     links:
       - phpfpm
     volumes:
       - code:/var/www/html
  
   phpfpm:
    image:php-fpm
    links:
      - db
    volumes:
      - code:/var/www/html
  
   code:
     build:
     context: ./
     dockerfile: Dockerfile
     volumes:
       - code:/var/www/html
  
  volumes:
    code:
      driver: local
  </code></pre>
  
  <p>At this point the <strong>code volume</strong> was created. Copy of the php code from container code was copied to the volume.</p>
  
  <p>This is good as all new changes will be persisted to the volume although when I pull a new version of the codebase my volume will not get updated.</p>
  
  <p>What I would like to achieve is that my nginx and cron and tooling continer all see the latest version of the codebase container's content and as well I want to be able to run several one of containers calls using that php code that is in container 6.</p>
  
  <p>How do I need to do to go about that using v3 syntax?</p>
  
  <p>Thanks</p>