Comments (13)
You can create a persistent data container with the image itself.
First create the data container and with volume /var/opt/mssql
:
docker create -v /var/opt/mssql --name linuxsqldata microsoft/mssql-server-linux
Then mount the volumes from this container:
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' \
-p 1433:1433 -d \
--volumes-from linuxsqldata \
microsoft/mssql-server-linux
Now you can start and stop your container without losing your data. Additionally you can docker cp
a backup or the *.mdf
and *.ldf
files into this volume.
from mssql-docker.
You can either create a data container as @mystygage suggested or you can use docker run -v
to mount a host directory to map to the /var/opt/mssql/data
directory in the container.
Example:
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' \
-p 1433:1433 -d \
-v /my/host/data/directory:/var/opt/mssql/data \
microsoft/mssql-server-linux
More information:
https://docs.docker.com/engine/tutorials/dockervolumes/
We have removed the /opt/msssql/data volume for the next release of the mssql-server-linux image to avoid confusion.
from mssql-docker.
@twright-msft : do the same steps work for SQL Server 2016 Image for Windows Containers also ?
from mssql-docker.
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
This is an evaluation version. There are [118] days left in the evaluation period.
sqlservr: Debugger.cpp:531: static void Debugger::Print(const void , unsigned int): Assertion `m_IsAttached' failed.
Capturing core dump and information for sqlservr (pid 9)...
cat: /proc/9/sched: No such file or directory
cat: core.sqlservr.9.temp/log/debug.log: No such file or directory
No journal files were found.
No journal files were found.
ls: cannot access '/var/opt/mssql/log/log/errorlog': No such file or directory
ls: cannot access '/var/opt/mssql/log/log/exception.log': No such file or directory
ls: cannot access '/var/opt/mssql/log/log/SQLDu*.txt': No such file or directory
ls: cannot access '/var/opt/mssql/log/log/SQLDu*.mdmp': No such file or directory
Packaging core dump and information into compressed files.
Core dump and information will be written to /var/opt/mssql/log/core.sqlservr.02_15_2017_17_26_06.9 and logs in /var/opt/mssql/log/core.sqlservr.02_15_2017_17_26_06.9.log
ls: cannot access '/var/opt/mssql/log/log/system_health*': No such file or directory
from mssql-docker.
If i map only the data folder, i got this:
et up SA PASSWERD
This is an evaluation version. There are [118] days left in the evaluation period.
2017-02-15 17:27:32.48 Server Microsoft SQL Server vNext (CTP1.1) - 14.0.100.187 (X64)
Dec 10 2016 02:51:11
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
on Linux (Ubuntu 16.04.1 LTS)
2017-02-15 17:27:32.48 Server UTC adjustment: 0:00
2017-02-15 17:27:32.48 Server (c) Microsoft Corporation.
2017-02-15 17:27:32.48 Server All rights reserved.
2017-02-15 17:27:32.48 Server Server process ID is 4116.
2017-02-15 17:27:32.49 Server Logging SQL Server messages in file 'C:\var\opt\mssql\log\errorlog'.
2017-02-15 17:27:32.49 Server Registry startup parameters:
-d C:\var\opt\mssql\data\master.mdf
-l C:\var\opt\mssql\data\mastlog.ldf
-e C:\var\opt\mssql\log\errorlog
2017-02-15 17:27:32.51 Server Error: 17113, Severity: 16, State: 1.
2017-02-15 17:27:32.51 Server Error 87(The parameter is incorrect.) occurred while opening file 'C:\var\opt\mssql\data\master.mdf' to obtain configuration information at startup. An invalid startup option might have caused the error. Verify your startup options, and correct or remove them if necessary.
2017-02-15 17:27:32.52 Server SQL Server shutdown has been initiated
from mssql-docker.
@OpsSingular if you prefer a data volume instead of a data container, here is a gist for that:
https://gist.github.com/mystygage/b41bbfceeeb6dc8ab0f160485186061c
from mssql-docker.
@twright-msft sorry, forget to mention this easy way, because on macOS I have to create the data container.
from mssql-docker.
@mystygage - Good point! Using docker run -v
does not currently work on Docker for Mac for the mssql-server-linux image.
from mssql-docker.
@sg1970 Yes, but see the special notes about Windows containers here:
https://docs.docker.com/engine/tutorials/dockervolumes/#/mount-a-host-directory-as-a-data-volume
from mssql-docker.
I am struggling with the following error while trying to make persistent container when attaching database: (MacOS , Docker Toolbox with VirtualBox )
2017-02-15 17:12:28.09 spid52 FCB::Open failed: Could not open file /opt/mssql/data/bidbdat.mdf for file number 0. OS error: 87(The parameter is incorrect.).
At the same time - if i open terminal from Kitematic - no issue echoing to the file...
from mssql-docker.
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?
from mssql-docker.
No - i used the image https://github.com/moisei/mssql-server-linux - however the only difference i see is entrypoint script
from mssql-docker.
@Gorbush i get the same error. Currently creating a data container as @mystygage suggested
from mssql-docker.
Related Issues (20)
- Unable to lock /var/opt/mssql/ HOT 3
- custimize build error: "mkdir: cannot create directory '/usr/config': Permission denied" HOT 1
- install.tar is part of the final image, makes the image 1.3 GB bigger than necessary HOT 7
- Fail to run conatiner with Error "Too many open files"
- mssql Error: 17113, Severity: 16, State: 1. Error 5 (Access Denied)
- EXCEPTION_ACCESS_VIOLATION HOT 14
- Massive virtual memory usage while running linux container with only one DB
- Confusing Password Validation Error Message HOT 1
- Broken/held packages for libldap HOT 1
- Machine Learning Extension SQL Server 2022 not working HOT 1
- mssql for arm64 HOT 2
- Cannot connect SQLServer docker from ASP.NET Core 8 HOT 1
- Security vulnerabilites identified in sqlserver linux docker image
- Unable to start container on Linux 6.7 HOT 63
- Incompatible permissions tracking 2022-latest (from 2022-CU10-ubuntu-22.04 to 2022-CU11-ubuntu-22.04) HOT 1
- Issuse pulling any image from mcr.microsoft.com/mssql/ HOT 1
- Issue with AD on mssql-docker linux > CU9 (Ubuntu 22.04 vs 20.04) HOT 2
- Daylight savings time - wrong time with 2017-latest HOT 1
- LDF files are not moved to MSSQL_LOG_DIR
- Restore command is hanging after logged as success HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mssql-docker.