Question

I am having reasonable success running SQL Server for Linux on Docker for Mac, as per the instructions on https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-docker. The article also notes that:

Volume mapping for Docker-machine on Mac with the SQL Server on Linux image is not supported at this time.

This, of course, makes it difficult to do any more than really simple testing on the Mac if you have to re-install the database every time you start up Docker.

Has anybody a suggested strategy for maintaining a database beyond the current session?

Was it helpful?

Solution

This is a known issue: mapping volumes on Macs isn't supported yet. You can follow that Github issue for more news, like when it's fixed.

Until then, no, people aren't doing anything more than simple testing with that combination of tools (Mac, Docker, Linux, SQL Server).

If you need to do real, productive development on a platform that's supported today, use:

  • The current supported version of SQL Server (2016, as of this writing)
  • Running on a currently supported OS (Windows, as of this writing)
  • If you insist on using a Mac as your hardware layer (as I do too), then the easiest way to bridge these technologies is a hypervisor like VMware Fusion or Parallels

OTHER TIPS

@BrentOzar answered my question, but I have since found a workable solution.

An alternative approach is to use a Data Volume Container. Simply put:

docker create -v /var/opt/mssql --name mssql microsoft/mssql-server-linux /bin/true

docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=…' -p 1433:1433 --volumes-from mssql -d --name sql-server microsoft/mssql-server-linux

In the above:

  • --name mssql: mssql is an arbitrary name for your data container
  • -e SA_PASSWORD=…: obviously needs to be a real password
  • --name sql-server: sql-server is an arbitray name for my SQL Server container.

It works after successive restarts of Docker.

Thanks also to @AaronBertrand for pointing me to https://github.com/Microsoft/mssql-docker/issues/12 and, from there to @twright-msft for pointing me to Data Volume Containers.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top