With the increasing popularity of containerization, Microsoft's SQL Server also supports running and deploying on Docker, and this article installs the SQL Server 2019 database on a CentOS 8 system with Docker containers installed.
Installation conditions:
Docker Engine 1.8+ on any supported Linux distribution or for Docker for Mac/Windows. Docker overlay2 storage driver. This is the default setting for most users. At least 2 GB of disk space. At least 2 GB of RAM.
Pull the mirror
docker repository address:The hyperlink login is visible., the image is stored in Microsoft's private repository, but the page will announce version updates and other information.
The command is as follows:
Image Release Notes:
GA = General Availability - When a release is officially available and supported. CU = Cumulative Updates - Released regularly, including bug fixes, security fixes, and the occasional minor feature. CTP = Community Technology Preview - The preview version before the upcoming release of the new GA. GDR = General Distribution Release - Contains only the version that contains the security fix.
environment variable
environment variable | illustrate | ACCEPT_EULA | Set the ACCEPT_EULA variable to any value to confirm acceptance of the End User License Agreement. Required settings for SQL Server images. | MSSQL_SA_PASSWORD | Configure the SA user password. | MSSQL_PID | Set the SQL Server version or product key. Possible values include: compute developer Express Web standard enterprise Product key
If you specify a product key, it must be in the format #####-#####-#####-#####-#####, where "#" is a number or letter. | MSSQL_LCID | Set the language ID for SQL Server. For example, 1036 is in French. | MSSQL_COLLATION | Set the default collation for SQL Server. This overrides the Language ID (LCID) to the default mapping of the collation. | MSSQL_MEMORY_LIMIT_MB | Sets the maximum amount of memory (in MB) that SQL Server can use. By default, it is 80% of the total physical memory. | MSSQL_TCP_PORT | Configure the TCP port that SQL Server listens on (default is 1433). | MSSQL_IP_ADDRESS | Set the IP address. Currently, the IP address must be IPv4 style (0.0.0.0). | MSSQL_BACKUP_DIR | Set the default backup directory location. | MSSQL_DATA_DIR | Change the creation directory of the new SQL Server database data file (.mdf). | MSSQL_LOG_DIR | Change the creation directory of the new SQL Server database log file (.ldf). | MSSQL_DUMP_DIR | Change the default directory where SQL Server stores memory dumps and other troubleshooting files. | MSSQL_ENABLE_HADR | Enable availability groups. For example, "1" is enabled and "0" is disabled | MSSQL_AGENT_ENABLED | Enable the SQL Server agent. For example, "true" is enabled and "false" is disabled. By default, the agent is disabled. | MSSQL_MASTER_DATA_FILE | Set the location of the primary database data file. Before you run SQL Server for the first time, you must name it master.mdf. | MSSQL_MASTER_LOG_FILE | Set the location of the primary database log file. Before you run SQL Server for the first time, you must name it mastlog.ldf. | MSSQL_ERROR_LOG_FILE | Set the location of the error log file. |
Start a SQL Server 2019 application
First, to prevent container data loss, we need to map the database file directory in the container to a directory on the host machine. The command is as follows:
Remark:Be sure to set the users and groups to which the directory belongs, will the error be as follows:
SQL Server 2019 will run as non-root by default. This container is running as user mssql. To learn more visitThe hyperlink login is visible.
/opt/mssql/bin/sqlservr: Error: The system directory [/.system] could not be created. File: LinuxDirectory.cpp:420 [Status: 0xC0000022 Access Denied errno = 0xD(13) Permission denied] Configure some startup parameters according to the environment variables to start an application with the following command:
SQL Server 2019 key (For learning testing only, do not use in production environments)
Enterprise:HMWJ3-KY3J2-NMVD7-KG4JR-X2G8G Strandard:PMBDC-FXVM3-T777P-N4FY8-PKFF4
The password should conform to the SQL Server default password policy, otherwise the container will stop working if it fails to set up SQL Server. By default,The password must be at least 8 characters long and must contain one of the following four charactersThree: Uppercase letters, lowercase letters, decimal numbers, and symbols.
The host can mount on the found container/var/opt/mssqldirectory, and other files such as SQL Server system binaries are not supported.
After the container starts, check the logs as shown in the following image:
Go inside the container, as shown below:
Connect to a SQL Server 2019 database
Download SQL Server Management Studio (SSMS):The hyperlink login is visible.
Open the SSMS tool, enter the address, account number, and password to test a new database, as shown in the figure below:
Resources:
The hyperlink login is visible.
The hyperlink login is visible.
The hyperlink login is visible.
|