title: Mounting a network drive with docker compose on Windows 10
body: <p>I've been successfully mounting volumes on Windows 10 in various projects recently using the example docker-compose.yml file below. For a new project today I needed to mount a folder from the Z:/ drive (a network mounted drive which appears as <code>\\IP.IP.IP.IP\public\data (Z:)</code> when I navigate to that area in Windows File Explorer.</p>
  <p>When I edit the volumes to point to locations on Z: (e.g. in the second docker-compose.yml below), the volumes are not mounted properly and are empty folders when I connect to the container via the CLI.</p>
  <p>Any advice on getting the Z: drive folders to mount properly would be great, thanks.</p>
  <p>Working docker-compose.yml file:</p>
  <pre class="lang-yaml prettyprint-override"><code>version: '3.1'
  
  services:
    db:
      image: mysql:8.0.25
      container_name: db
      restart: always
      secrets:
        - mysql_root
      environment:
        MYSQL_ROOT_PASSWORD_FILE: /run/secrets/mysql_root
        MYSQL_DATABASE: donuts
        TZ: &quot;Australia/NSW&quot;
      volumes:
        - mysql-data:/var/lib/mysql
        - ./mysql-init.sql:/docker-entrypoint-initdb.d/mysql-init.sql
      network_mode: &quot;host&quot;
    
    voyager_donuts:
      container_name: voyager_donuts
      build:
        context: .
        dockerfile: Dockerfile
      image: voyager_donuts
      network_mode: &quot;host&quot;
      environment:
        TZ: &quot;Australia/NSW&quot;
      volumes:
        - c:/Users/MYUSERNAME/data/DonutsCalibration:/voyager_calibration
        - c:/Users/MYUSERNAME/data/DonutsLog:/voyager_log
        - c:/Users/MYUSERNAME/data:/voyager_data
        - c:/Users/MYUSERNAME/data/DonutsReference:/voyager_reference
  
  volumes:
    mysql-data:
  
  secrets:
    mysql_root:
      file: ./secrets/mysql_root
  </code></pre>
  <p>Broken volumes docker-compose.yml file:</p>
  <pre class="lang-yaml prettyprint-override"><code>version: '3.1'
  
  services:
    db:
      image: mysql:8.0.25
      container_name: db
      restart: always
      secrets:
        - mysql_root
      environment:
        MYSQL_ROOT_PASSWORD_FILE: /run/secrets/mysql_root
        MYSQL_DATABASE: donuts
        TZ: &quot;Australia/NSW&quot;
      volumes:
        - mysql-data:/var/lib/mysql
        - ./mysql-init.sql:/docker-entrypoint-initdb.d/mysql-init.sql
      network_mode: &quot;host&quot;
    
    voyager_donuts:
      container_name: voyager_donuts
      build:
        context: .
        dockerfile: Dockerfile
      image: voyager_donuts
      network_mode: &quot;host&quot;
      environment:
        TZ: &quot;Australia/NSW&quot;
      volumes:
        - z:/RAW/DonutsCalibration:/voyager_calibration
        - z:/RAW/DonutsLog:/voyager_log
        - z:/RAW:/voyager_data
        - z:/RAW/DonutsReference:/voyager_reference
  
  volumes:
    mysql-data:
  
  secrets:
    mysql_root:
      file: ./secrets/mysql_root
  </code></pre>