title: How to prevent a bind mounted directory to be overridden by container's data
body: <p>My docker-compose.yml is like below where I have mounted my local dir <code>code/drupal</code> to <code>/var/www/example.com</code>. My container creates some temporary cache files inside <code>/var/www/example.com/temp/</code>. I want to map everything from container to host and host to container i.e in bidirectional but excluding the <strong>temp</strong> dir. Infact I don't want the content of that temp dir should be synchronized with my host machine.  </p>
  
  <pre><code>version: "3.3"
  
  services:
  
    nginx:
      build: ./docker/nginx
      volumes:
        - drupal:/var/www/example.com
  
  volumes:
    drupal:
      driver: local
      driver_opts:
        type: none
        device: $PWD/code/drupal
        o: bind
  </code></pre>