0

I am new to container. I created one image of sql server for windows container by referring: https://github.com/microsoft/mssql-docker/tree/master/windows/mssql-server-windows-developer

I am able to connect to the server. Now I want to persist the data using volume so that I don't loose data on container deletion. The default path for linux is /var/opt/mssql and for windows is C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA. I am trying to run the below command where "my-sql-image" is the sql server image for windows:

docker run -d -p 1433:1433 -v sqlvolume:"c:\program` files\microsoft` sql` server\mssql15.mssqlserver\mssql\data" -e sa_password=****** -e ACCEPT_EULA=Y my-sql-image:2019

I tried modifying the path like all the characters in small case and escaping the spaces in the path by ticks and quotes. But when I delete the container, the data is not being persisted. Not sure what I am doing incorrect.

David Maze
  • 130,717
  • 29
  • 175
  • 215
Manognya
  • 37
  • 5
  • Are you sure you're using an SQL Server image for Windows containers? That program got terminated over a year ago and all Microsoft-supplied images withdrawn. Ref: [Update- Beta program for SQL Server on Windows container is suspended](https://techcommunity.microsoft.com/t5/sql-server-blog/update-beta-program-for-sql-server-on-windows-container-is/ba-p/2516639). – AlwaysLearning Jul 20 '22 at 13:05
  • The image for windows is not available officially but we can create our own custom images. I followed that git repo to create one. – Manognya Jul 20 '22 at 13:24

1 Answers1

0

First, as pointed out previously, SQL Server on Windows containers is not supported anymore. This means you should not run this in production. If all you want to do is to test it, it's fine.

Do you get an error when running the command above? The command for -v should follow the following - docker run -v c:\ContainerData:c:\data:RW

You can see the documentation for this here: https://learn.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/persistent-storage