We're looking into migrating our SQL Server environment to use containers.

I've successfully built a WindowsCore image with SQL Server installed. The instance is accessible with the data files using volumes so that they persist.

My question is where should I put my system databases? Im thinking externally so that things like logins etc persist, and Ill just have to put a startup procedure to if serverproperty('Machinename') <> @@servername usp_dotheservernamething;, but is that wise?

If I put it in the image, I still would need to rename the server, but then I suppose if I start a new container in lets say a dev environment, I wouldn't have to worry about a drive.

Thinking out loud, I could possibly add onto the startup procedure to have to change the system database mappings if the servername is a production db name? That way if we spin up a dev/qa/local container it will have system databases, but if its production it will go to the external volume for its databases...


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.