title: docker-compose volumes syntax for local driver to mount a file
body: <p>I am attempting to mount a file (nginx.conf) in the <code>volumes</code> section of my <code>docker-compose.yml</code>. I can mount a directory as a volume without issue, however, it is not clear to me what the syntax is for a file.</p>
  
  <p>I have the following defined in my <code>volumes</code> section</p>
  
  <pre><code>volumes:
      roundcubeweb:
        driver: local
        driver_opts:
          type: none
          o: bind
          device: /mnt/docker/volumes/roundcube/html
      nginxconf:
        driver: local
        driver_opts:
          type: none    
          o: bind
          device: /mnt/docker/volumes/roundcube/nginx.conf
  </code></pre>
  
  <p>Later on, I have the following under my services section</p>
  
  <pre><code>nginx:
    image: nginx:latest
    deploy:
      replicas: 1
    restart: always
    depends_on: 
      - roundcube
    ports:
      - "8082:80"
    volumes:
      - roundcubeweb:/var/www/html
      - nginxconf:/etc/nginx/conf.d/default.conf
  </code></pre>
  
  <p>When I attempt to start this up, I receive the following error:</p>
  
  <blockquote>
    <p>ERROR: for roundcube_nginx_1  Cannot create container for service
    nginx: failed to mount local volume: mount /mnt/docker
    /volumes/roundcube/nginx.conf:/var/lib/docker/volumes/roundcube_nginxconf/_data,
    flags: 0x1000: not a directory</p>
    
    <p>ERROR: for nginx  Cannot create container for service nginx: failed to
    mount local volume: mount /mnt/docker/volumes/rou
    ndcube/nginx.conf:/var/lib/docker/volumes/roundcube_nginxconf/_data,
    flags: 0x1000: not a directory ERROR: Encountered errors while
    bringing up the project.</p>
  </blockquote>
  
  <p>I've found that if I inline the file location in the nginx service section's volume declaration then it works just fine. For example:</p>
  
  <pre><code>   volumes:  
      - roundcubeweb:/var/www/html  
      - /mnt/docker/volumes/roundcube/nginx.conf:/etc/nginx/conf.d/default.conf  
  </code></pre>
  
  <p>Can one not mount a file in the <code>volumes</code> section? Is there a reference for the local driver's parameters?</p>