Now .net core is cross-platform, and everyone is using Linux and Docker. SQL SERVER, which is often used with .net, has always been Windows only, but since SQL Server 2017, it has supported running on Docker, which means that SQL Serer can now run on Linux. SQL Server in Docker sudo docker pull mcr.microsoft.com/mssql/server:2019-CTP3.2-ubuntu Use the docker pull command to pull the image of sqlserver 2019-ctp3.2 from docker hub sudo mkdir /hd2/sqlserver2019_data sudo docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=dev@123," -p 14330:1433 --name sqlserver2019 -v /hd2/sqlserver2019_data:/var/opt/mssql -d mcr.microsoft.com/mssql/server:2019-CTP3.2-ubuntu Use the docker run command to start the container. Note that the -v parameter specifies that the sqlserver2019_data directory is mounted to the container's /var/opt/mssql directory. This directory is used to store database files, so it is best to mount it outside the container to avoid data loss due to accidental container deletion. sudo docker ps -a Use the docker ps command to view the running status of the container, and you can see that sqlserver2019 is running Connecting to SQL Server Using the Command Line sudo docker exec -it sqlserver2019 "bash" Use the docker exec command to log in to the container and execute commands /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P dev@123, Execute the command inside the container and open sqlcmd CREATE DATABASE TEST_DB GO USE TEST_DB GO CREATE TABLE Table1 (ID INT, NAME NVARCHAR(50)) GO Insert Into Table1 Values (0, 'agile') Create TEST_DB database; create table Table1; insert a row of data; query table data The SQL Server we run using Docker can also be managed using Sql Server Management Studio. After successfully connecting using the server IP and port, you can see that the newly created database TEST_DB and table TABLE1 as well as the data in them are all there. It is much easier to manage with SSMS, and there is no difference from using other versions of SQL Server. So far, the basic operations of SQL Server in Docker have been demonstrated. There are more advanced features such as configuring failover clusters, replication subscriptions, Always On, etc., which are a little different from the Windows environment configuration. You can try it yourself. This is the end of this article about using Docker to run SQL Server. For more information about running SQL Server with Docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! Author: Agile.Zhou(kklldog) You may also be interested in:
|
<<: About WeChat Mini Program to implement cloud payment
>>: What does mysql database do
As shown in the figure: Check port usage: sudo ne...
After installing MySQL, you will find that the ro...
After the server where Docker is located has been...
1 Introduction Apache Storm is a free, open sourc...
Table of contents Preface 1. What is a lock? 2. L...
How to change the password in MySQL 5.7.18: 1. Fi...
The specific code for implementing skinning with ...
Environment Introduction Operating system: centos...
Related system calls for file operations create i...
This article shares the specific code of JavaScri...
Table of contents Packaging, launching and optimi...
Table of contents 1. Introduction to grub.cfg fil...
Table of contents 1. Application and configuratio...
Table of contents Transaction Isolation Level Pro...
The specific code is as follows: <!DOCTYPE htm...