title: Change source path of volume
body: <p>This dockerfile works as expected. But the problem is that I am not able to change the source of volume.</p>
  
  <pre><code>version: "3.5"
  services:
    mysql:
      environment:
        MYSQL_ROOT_PASSWORD: india3391
      image: shantanuo/mysql:5.7
      ports:
      - mode: ingress
        target: 3306
        published: 3391
        protocol: tcp
      volumes:
      - type: volume
        source: dbvol
        target: /var/lib/mysql
  volumes:
    dbvol: {}
  </code></pre>
  
  <p>It seems to create a directory_name + volume_name folder in default docker installation that looks like this...</p>
  
  <pre><code>"Source": "/var/lib/docker/volumes/hashi1_dbvol/_data",
  </code></pre>
  
  <p>Is there a way to change this path?</p>
  
  <hr>
  
  <p>Update:</p>
  
  <pre><code># cat docker-compose.yml
  version: "3.5"
  services:
    mysql:
      environment:
        MYSQL_ROOT_PASSWORD: india3391
      image: shantanuo/mysql:5.7
      ports:
      - mode: ingress
        target: 3306
        published: 3391
        protocol: tcp
      volumes:
      - type: volume
        source: dbdata
        target: /var/lib/mysql
  
  volumes:
    dbdata:
      driver: local
      driver_opts:
        type: 'none'
        o: 'bind'
        device: '/srv4/db-data'
  </code></pre>
  
  <p>This compose file will work only if I first create the mount directory</p>
  
  <pre><code>mkdir -p /srv4/db-data
  </code></pre>
  
  <p>The volume parameter of docker run command will create this directory on the fly.
  Why is docker compose not able to create the directory?</p>