Running Microsoft SQL Server on Linux in Docker
One of the organizations that recently consulted me for advice, no longer willing to be extortion by Microsoft's high licensing fees, and plans to replace all Windows Server with Linux (Ubuntu). No big deal for services written in PHP, Java, and other cross platform languages. But some of the systems use MicroSoft SQL Server as their Database. The permanent cure is to migrate to MySQL, MariaDB, or other OpenSource Databases. But it takes time to translate all schema and queries. The other solution is to use Microsoft SQL Server on Linux in Docker as a temporary workaround.
Env: Ubuntu 16.04
Run official docker image
Pull and run
$ docker run --name mssql-server-linux -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -d microsoft/mssql-server-linux
Check
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7c73a9a4d0ef microsoft/mssql-server-linux "/bin/sh -c /opt/m..." 25 minutes ago Up 25 minutes 0.0.0.0:1433->1433/tcp mssql-server-linux
Connect and run T-SQL
Once it's running, you can connect it with built in mssql tools
$ docker exec -it mssql-server-linux /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'yourStrong(!)Password'
>1
Try some command
1> SELECT Name from sys.Databases;
2> GO
Name
--------------------------------------------------------------------------------------------------------------------------------
master
tempdb
model
msdb
(4 rows affected)
1> CREATE DATABASE testdb;
2> GO
1> USE testdb;
2> GO
Changed database context to 'testdb'.
1> CREATE TABLE inventory (id INT, name NVARCHAR(50), quantity INT);
2> GO
1> INSERT INTO inventory VALUES (1, 'banana', 150);
2> INSERT INTO inventory VALUES (2, 'orange', 154);
3> GO
(1 rows affected)
(1 rows affected)
1> SELECT * FROM inventory WHERE quantity > 152;
2> GO
id name quantity
----------- -------------------------------------------------- -----------
2 orange 154
(1 rows affected)
1> QUIT
Additional Info
Data dir
root@7c73a9a4d0ef:~# ls /var/opt/mssql/data/
master.mdf model.mdf msdbdata.mdf tempdb.mdf testdb.mdf
mastlog.ldf modellog.ldf msdblog.ldf templog.ldf testdb_log.ldf
In Dockerfile we can see there's no entrypoint.sh MSSQL server is directly executed
CMD /opt/mssql/bin/sqlservr.sh
If you want to build your app extending from this image and has your own entrypoint.sh, this is an example
Reference
https://hub.docker.com/r/microsoft/mssql-server-linux/ https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-connect-and-query-sqlcmd https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-troubleshooting-guide#connection https://github.com/Microsoft/mssql-docker/blob/dc52dd5391fe397455430d04ffeb4ecb547e80fe/linux/preview/Dockerfile#L15
- Email this page
- 2721 reads
- 繁體中文
Comments
careen joseph (not verified)
Mon, 02/26/2018 - 13:27
Permalink
hadoop-training-in-chennai
Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
https://www.besanttechnologies.com/training-courses/data-warehousing-tra...
contactsamplemail (not verified)
Wed, 02/28/2018 - 14:30
Permalink
swoftware
About Austere Technologies
Austere Technologies is an IT Services, Consulting and Technology company. We have partnered with global software vendors to help our customers in digital transformation and technology services. We combine a network of top talent with strong technical expertise, Industry knowledge and extensive project experience in delivering solutions that help customers optimize Business Processes, streamline Infrastructure, Cloud services and gain competitive advantage.
Some of the key services we deliver and not limited to are:
Custom application development using open framework and technologies
Implementation and deployment of packaged applications based on Microsoft, SAP and Oracle Technologies
End to end Application Quality Management
Automated Functional and Performance Testing using open and custom frameworks
Application Security
Help our customers in Product demonstration and evaluation process
Onsite and remote support with highly skilled support engineers
inigojoseph (not verified)
Mon, 03/05/2018 - 13:58
Permalink
java training in bangalore
Thanks a lot very much for the high your blog post quality and results-oriented help. I won’t think twice to endorse to anybody who wants and needs support about this area. java training in bangalore
preethishetty (not verified)
Wed, 03/07/2018 - 19:11
Permalink
SQL Server Online Training
Good information, very informative and useful for the people who are in need of this.
SQL Server Online Training | Unix Linux Training
abriljoseph (not verified)
Mon, 03/12/2018 - 13:55
Permalink
hadoop-training-in-bangalore
I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
https://www.besanttechnologies.com/training-courses/data-warehousing-tra...
kanaga (not verified)
Wed, 03/14/2018 - 14:32
Permalink
Embedded Training in Chennai
I really like your post.It’s really informative and interesting.I really appreciate that.Thank you for sharing valuable information. Nice post. I enjoyed reading this post. The whole blog is very nice found some good stuff and good information here Thanks...
Embedded training in Chennai
Kavitha (not verified)
Wed, 03/14/2018 - 14:34
Permalink
PLC training Institute in Chennai
We are truly thankful for your blog entry. You will discover a great deal of methodologies in the wake of going to your post...
PLC training Institute in Chennai
Saranya (not verified)
Wed, 03/14/2018 - 14:39
Permalink
Mechanical Project Centre in Chennai
Nice post..Thanks for sharing this useful and interesting article..
IEEE Projects in Chennai | Mechanical project centre in Chennai
santhosh kumar (not verified)
Sat, 03/17/2018 - 18:36
Permalink
angularjs training in chennai
Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this. angularjs training in chennai
AngularJS cours... (not verified)
Tue, 03/20/2018 - 19:17
Permalink
Excellent information, really
Excellent information, really helpful to me.
Angularjs Training in Chennai
preethishetty (not verified)
Thu, 03/22/2018 - 20:59
Permalink
This is what I am looking for
This is what I am looking for since days ago. Now, feeling happy after reading this and I used to read your blog regularly...
Docker Online Training | Struts Training
ReactJS Trainin... (not verified)
Thu, 03/29/2018 - 19:03
Permalink
Education
Thanks admin, share more like this.
React js Training in Chennai
web designing c... (not verified)
Wed, 04/04/2018 - 17:11
Permalink
Training
Every point in your content is a valid one . Thank you admin
web development courses in chennai |
iOS Training in Chennai
Anoushka (not verified)
Thu, 04/05/2018 - 14:00
Permalink
Big Data Training
Excellent way of writing with suitable examples for each point, keep sharing such valuable blog regarding technology. Hadoop Training in Chennai | Big Data Training |
cloud computing training in chennai
Ramramky (not verified)
Fri, 04/06/2018 - 19:07
Permalink
Training
Excellent post !!!Everyone are repeating the same concept in their blog, but here I get a chance to know new things. I will also suggest your content to my friends.
JAVA Training in Chennai
JAVA Course in Chennai
Best JAVA Training in Chennai
Salesforce Cour... (not verified)
Sat, 04/07/2018 - 19:08
Permalink
Training
Excellent information on your blog. thank you for taking the time to share with us. Amazing insight you have on this. it's nice to find a website that details so much information.
iOS Training in Chennai |
Loadrunner Training in Chennai | Salesforce Course in Chennai
Suba Mani (not verified)
Mon, 04/09/2018 - 15:15
Permalink
Education
I just like the valuable info you provide for your articles. Bookmark your weblog and take a look at once more right here regularly.
dot net course |
asp.net training in chennai
shethal (not verified)
Tue, 04/10/2018 - 19:22
Permalink
Python courses Training
Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.
https://www.besanttechnologies.com/training-courses/python-training-inst...
Divyadharshini (not verified)
Wed, 04/11/2018 - 23:21
Permalink
Best React JS Training Institute
Thanks for the great articles that you share on this website.
Keep posting more.
- Priya,
Best React JS Training Institute
austero (not verified)
Thu, 04/12/2018 - 19:13
Permalink
Software Security
REALLY VERY EXCELLENT INFORMATION. I AM VERY GLAD TO SEE YOUR BLOG FOR THIS INFORMATION. THANKS FOR SHARING. KEEP UPDATING.
Best Software Security Services | Austere Technologies
Anoushka (not verified)
Wed, 04/18/2018 - 15:09
Permalink
Android Training
Thank you for sharing such valuable information and tips. This can give insights and inspirations for us; very helpful and informative! I would love to see more updates from you in the future.
Android Course in Chennai
Android Training Chennai
sakthimurugan (not verified)
Thu, 04/19/2018 - 13:51
Permalink
Excellent article
Thank you for this post!! I have just discovered your blog recently and I really like it! I will definitely try some of your insights.
Salesforce Training in Chennai
Salesforce Training
Add new comment