Skip to content
Advertisement

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

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:SQLdata:/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:templatedatamaster.mdf' to '/var/opt/mssql/data/master.mdf'.
2020-05-13 20:39:01.99 Server      ERROR: Setup FAILED copying system data file 'C:templatedatamaster.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.

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement