title: Allowing multiple services in docker-compose to share a merged volume
body: <p>Given a <code>docker-compose.yml</code> file like below, I'm looking for a way that both service <code>a</code> and <code>b</code> can have access to a shared volume which consists of the <em>merged</em> contents of both containers.</p>
  
  <pre><code>version: '3'
  volumes:
     shared-merged-volume:
  services:
     a:
       volumes:
         - shared-merged-volume:/shared
     b:
       volumes:
         - shared-merged-volume:/shared
  </code></pre>
  
  <p>Let's say service <code>a</code> has a directory at <code>/shared/dir-from-a</code> and service <code>b</code> has a similar <code>/shared-dir-from-b</code> directory.  The desired result is to end up with:</p>
  
  <pre><code>$ ls /shared # from either container
  dir-from-a
  dir-from-b
  </code></pre>
  
  <p>What I find is that one of the containers "wins" and only one of those two directories is ever present.  I can work around the issue like this but is more verbose and requires modification if directory contents ever changes:</p>
  
  <pre><code>version: '3'
  volumes:
     service-a-shared-volume:
     service-b-shared-volume:
  services:
     a:
       volumes:
         - service-a-shared-volume:/shared/dir-from-a
         - service-b-shared-volume:/shared/dir-from-b
     b:
       volumes:
         - service-a-shared-volume:/shared/dir-from-a
         - service-b-shared-volume:/shared/dir-from-b
  </code></pre>
  
  <p>Thanks in advance for any help!</p>