CENTOS use Docker to install SQLSERVER and the pits encountered

2023-01-02   ES  


The installation and configuration of docker in



First install the docker in Centos7 according to the above


Follow the public account
Domineering program ape
Get programming -related e -books, tutorial push and free download.


1. Create a new directory MSSQLVOL on CenoOS. In this directory, create three directory three directory DATA, LOG, and Secrets for SQLServer’s data volume mapping.

2, pull the mirror image

docker pull mcr.microsoft.com/mssql/server:2019-latest

3. Start

sudo docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=badao123456' -p 1433:1433 -v /mssqlvol/data:/var/opt/mssql/data -v /mssqlvol/log:/var/opt/mssql/log -v /mssqlvol/secrets:/var/opt/mssql/secrets -d mcr.microsoft.com/mssql/server:2019-latest

command detailed explanation:

-e ‘accept_eula = y’ represents the consent of the SQL Server’s box, otherwise it will not be used.

-e ‘mssql_sa_password = badao123456’ Set the password of the SA user. The password length must be at least 8 characters, including the three sets of characters in the following four groups: uppercase letters, lowercase letters, numerals and symbols based on 10 -based numbers and symbols. Essence

-P 1433: 1433 Map the host 1443 with the container 1443 port

The three -V latter -V is the mapping of the data volume

-D backstage run

4. Open firewall port

firewall-cmd --zone=public --add-port=1433/tcp --permanent
firewall-cmd --reload

5. Enter the container

docker exec -it b998d4bee197 /bin/bash

later followed the container ID

Then go to/OPT/MSSQL-Tools/Bin, use SQLCMD to connect and create a table, and query all tables

/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Badao123456

Through statement

4> SELECT Name from sys.Databases;
5> go




Exit statement



Exit container

6. Connect SQLServer

download ssms


download after download, connect after installation

Enter the places where the data volume mapped above the data volume stored DATA data

You can see that the database mapping is also successful

7, step on the pit 1

After the container started, it would be gone after a while. You can check the logs by viewing the log

View the container running log, followed by the container ID

docker logs -f b998d4bee197

log tips:

Setup FAILED copying system data file ‘C:\templatedata\master.mdf’ to ‘/var/…   5(Access is denied)

The reason is that the directory authority of the data volume mapping is not enough

Gives permissions

sudo chmod 777 -R  /mssqlvol

and then use the Sudo Docker Run when running the container. It turned out to be directly used Docker Run

8, step on the pit 2

run again for a while. View the log again

The password does not meet SQL Server password policy requirements because it is not complex enough. The password must be at least 8 characters long and contain characters from three of the following four sets: Uppercase letters, Lowercase letters, Base 10 digits, and Symbols

This is because the password is too simple and does not meet the requirements

The length of the password must be at least 8 characters, and includes the three sets of characters in the following four groups: uppercase letters, lowercase letters, 10 -based numbers and symbols

9, step on the pit three

When using Navicat connection, prompt:

remote host forced to close a existing connection, Client Unable to Establish Connection (10054)

download SSMS to connect, may be related to the non -opening agent, so the use of Navicat cannot be connected.

10, step on the pit four

Reminder in the

Log: This Program Requires A Machine with at Least 2000 Megabytes of Memory

This is because the virtual machine is used here, and SQLServer requires at least 2g of memory.

11. Official tutorial

can be deployed and configured with reference to the official tutorial



Random Posts

Demolition a digital of a positive integer n in each position, and then store it into the array

PYQT5 Learning Notes 10 —- QCOLORDIALOG and QFONTDialog

About Make prompt Must be enabled with the -std = c ++ 11 or -Std = GNU ++ 11 Compileer Options

Python three -level menu Hidingin

IOS MANSORY is equal to equal -width height arranged multiple views