In docker-compose file I want to create a named volume which will target local drive for test purposes. For production we will use NFS.
I created the compose file as following,
version: '3.3'
services:
  test:
    build: .
    volumes:
      - type: volume
        source: data_volume
        target: /data
    networks:
      - network
volumes:
  data_volume:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: c:/data
networks:
  network:
    driver: overlay
    attachable: true
When I run the docker-compose up, I got the following error,
for test_test_1  Cannot create container for service test: failed to mount local volume: 
mount c:/data:/var/lib/docker/volumes/test_data_volume/_data, flags: 0x1000: no such file 
or directory
Even with errors, it still creates the named volume. So when I inspect it,
{
    "CreatedAt": "2019-10-07T09:10:14Z",
    "Driver": "local",
    "Labels": {
        "com.docker.compose.project": "test",
        "com.docker.compose.version": "1.24.1",
        "com.docker.compose.volume": "data_volume"
    },
    "Mountpoint": "/var/lib/docker/volumes/test_data_volume/_data",
    "Name": "test_data_volume",
    "Options": {
        "device": "c:/data",
        "o": "bind",
        "type": "none"
    },
    "Scope": "local"
}
I'm still not sure why the Mountpoint is targeting that location. I know I can achieve this without named volume (which I already did), but for future in the project we definitely need named volume.
Any suggestion how to achieve this?