Docker for Windows - can't mount volume

Viewed 352

I am having trouble moutning a volume and I am not sure how to troubleshoot this. This is running on my local machine, and was working until this week.

I am running Docker version 20.10.11, build dea9396, on a Windows 10 machine with the default install. I am also getting the problem on a machine running Docker version 20.10.8, build 3967b7d

I create a volume on the current direction as follows:

docker volume create --driver local --opt type=none --opt o=bind --opt device=%cd%/sql/data sqlserver_data

Then I start a sql server container using this volume as follows:

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=abc123" -p 1433:1433 -v sqlserver_data:/var/opt/mssql/data -d mcr.microsoft.com/mssql/server:2019-latest 

This fails with the error:

docker: Error response from daemon: error while mounting volume '/var/lib/docker/volumes/sqlserver_data/_data': failed to mount local volume: mount %cd%/sql/data:/var/lib/docker/volumes/sqlserver_data/_data, flags: 0x1000: no such file or directory.

It's not just this command. I have existing docker-compose files that have worked for months and are now givivng this error. Such as:

>   tasks_db:
>     restart: always
>     environment:
>       - SA_PASSWORD=abc
>       - ACCEPT_EULA=Y
>     ports:
>       - 14330:1433
>     volumes:
>       - mssql-tasks-data:/var/opt/mssql/data

>   mssql-tasks-data:
>     driver: local
>     driver_opts: 
>       type: "none"
>       o: "bind"
>       device: ".tasks/DockerFiles/mssql/data"

I suspect it's a permission issue from a policy pushed to the machine, but I don't have anything to show that.

0 Answers
Related