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 \\IP.IP.IP.IP\public\data (Z:) when I navigate to that area in Windows File Explorer.
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.
Any advice on getting the Z: drive folders to mount properly would be great, thanks.
Working docker-compose.yml file:
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: "Australia/NSW"
volumes:
- mysql-data:/var/lib/mysql
- ./mysql-init.sql:/docker-entrypoint-initdb.d/mysql-init.sql
network_mode: "host"
voyager_donuts:
container_name: voyager_donuts
build:
context: .
dockerfile: Dockerfile
image: voyager_donuts
network_mode: "host"
environment:
TZ: "Australia/NSW"
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
Broken volumes docker-compose.yml file:
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: "Australia/NSW"
volumes:
- mysql-data:/var/lib/mysql
- ./mysql-init.sql:/docker-entrypoint-initdb.d/mysql-init.sql
network_mode: "host"
voyager_donuts:
container_name: voyager_donuts
build:
context: .
dockerfile: Dockerfile
image: voyager_donuts
network_mode: "host"
environment:
TZ: "Australia/NSW"
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