-
Notifications
You must be signed in to change notification settings - Fork 747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Persistent data container #7
Comments
You can create a persistent data container with the image itself.
Then mount the volumes from this container:
Now you can start and stop your container without losing your data. Additionally you can |
You can either create a data container as @mystygage suggested or you can use
More information: We have removed the /opt/msssql/data volume for the next release of the mssql-server-linux image to avoid confusion. |
@twright-msft sorry, forget to mention this easy way, because on macOS I have to create the data container. |
@mystygage - Good point! Using |
@twright-msft : do the same steps work for SQL Server 2016 Image for Windows Containers also ? |
@sg1970 Yes, but see the special notes about Windows containers here: |
I am struggling with the following error while trying to make persistent container when attaching database: (MacOS , Docker Toolbox with VirtualBox ) At the same time - if i open terminal from Kitematic - no issue echoing to the file... |
And if i map the whole data folder - it is failing with another error - but right on start and even fails to start: Set up SA PASSWERD |
If i map only the data folder, i got this: |
I used Docker for Mac, but I think this makes no difference with volumes. How do you create the data volume? Based on the same image like mentioned in my comment above? |
No - i used the image https://github.com/moisei/mssql-server-linux - however the only difference i see is entrypoint script |
@Gorbush i get the same error. Currently creating a data container as @mystygage suggested |
@OpsSingular if you prefer a data volume instead of a data container, here is a gist for that: |
This goes for
microsoft/mssql-server-linux
.Can you explain why there two directories:
/opt/mssql/data
: This one is exposed as volume, so we can share data between host and container./var/opt/mssql/data
: This one actually holds database data *.mdf & .1df files.Then how can I create persistent data container?
Lets say I'm running brand new container, no custom database yet. Then my .NET application connect to SQL Server running in container, Entity Framework will push all migrations and create database. Now we get two new files in
/var/opt/mssql/data
,<DBName>.mdf
and<DBName>.ldf
. Because new database isn't created in/opt/mssql/data
database is lost if container is stopped.Shouldn't
/var/opt/mssql/data
be exposed as volume?Is storing database in
*.mdf
file good practice for production use?The text was updated successfully, but these errors were encountered: