Docker Community Forums

Share and learn in the Docker community.

Mysql container fails in volume specification on windows server 2019

I now have a server with system Windows Server 2019 Standard 64-bit installed. I have enabled Linux container in order to pull Mysql image from Docker Hub. The parameter COMPOSE_CONVERT_WINDOWS_PATHS values 1 now.

The docker-compose file I wrote is as followed:

version: '3'

services: 
    mysql:
        container_name: EE
        environment:
            MYSQL_ROOT_PASSWORD: "demo"
        command: 
            --character-set-server=utf8
        ports: 
            - 33065:3306
        image: "docker.io/mysql:5.7.16"
        volumes: 
            - "./db:/var/lib/mysql"
            - "./init:/docker-entrypoint-initdb.d/"

And I got the error:

ERROR: for EE  Cannot create container for service mysql: invalid volume specification: '/c/Users/Public/Documents/SharedDrive_NWServer/zih/EE/db:/var/lib/mysql:rw'

ERROR: for mysql  Cannot create container for service mysql: invalid volume specification: '/c/Users/Public/Documents/SharedDrive_NWServer/zih/EE/db:/var/lib/mysql:rw'

But in my laptop with windows 10 system, everything works well.

I also tried to change the volumes with abslout path like:

volumes: 
        - "C:/Users/Public/Documents/SharedDrive_NWServer/zih/EE/db:/var/lib/mysql"
        - "C:/Users/Public/Documents/SharedDrive_NWServer/zih/EE/init:/docker-entrypoint-initdb.d/"

But the same error appears.

I just tried named volume:

version: '3'

services: 
    mysql:
        container_name: EE
        environment:
            MYSQL_ROOT_PASSWORD: "demo"
        command: 
            --character-set-server=utf8
        ports: 
            - 33065:3306
        image: "docker.io/mysql:5.7.16"
        volumes: 
            - db_path:${DB_DESTINATION_PATH}
            - init_path:${INIT_DESTINATION_PATH}

volumes:
    db_path:
        driver: local
        driver_opts:
            device: ${DB_PATH}
    init_path:
        driver: local
        driver_opts:
            device: ${INIT_PATH}

And it shows the error:

Creating volume "ee_db_path" with local driver
ERROR: create ee_db_path: options are not supported on this platform

What other methods can I take a shot to solve the problems?