Unable to bind mount a Windows folder in a Linux SQL Server docker image

1

I'm trying to run the docker image mcr.microsoft.com/mssql/server:2019-latest on a windows host.

When running this command line, everything works fine:

docker run --rm -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=My_Password" -p 1433:1433 mcr.microsoft.com/mssql/server:2019-latest

When I try to bind mount the /var/opt/mssql/data folder to access it's content from my windows host, I get the following error:

PS C:\Docker> docker run --rm -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=My_Password" -v C:\SQL\data:/var/opt/mssql/data -p 1433:1433 mcr.microsoft.com/mssql/server:2019-latest
SQL Server 2019 will run as non-root by default.
This container is running as user mssql.
To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
2020-05-13 20:39:01.91 Server      Setup step is copying system data file 'C:\templatedata\master.mdf' to '/var/opt/mssql/data/master.mdf'.
2020-05-13 20:39:01.99 Server      ERROR: Setup FAILED copying system data file 'C:\templatedata\master.mdf' to '/var/opt/mssql/data/master.mdf':  31(A device attached to the system is not functioning.)
ERROR: BootstrapSystemDataDirectories() failure (HRESULT 0x8007001f)

It looks like this issue: https://support.microsoft.com/en-us/help/4212960/fix-sql-server-2017-won-t-start-with-linux-container-image-on-docker Which is supposed to be fixed. But I tried with several version of the docker image, including mcr.microsoft.com/mssql/server:2017-CU7-ubuntu, which is supposed to be the version in which that issue was fixed.

sql-server
linux
docker
mount
asked on Stack Overflow May 13, 2020 by Rouss • edited May 13, 2020 by Dale K

1 Answer

4

It seems to be an issue in the new Docker for Windows version. I did rollback from 2.3.0.2 to 2.2.0.5, and now the bind mount works as expected.

An issue has been raised about it in the mssql-docker github: https://github.com/microsoft/mssql-docker/issues/600

answered on Stack Overflow May 14, 2020 by Rouss

User contributions licensed under CC BY-SA 3.0