You can use different environment variables to configure SQL Server 2017 on Linux. These variables are used in two scenarios:
Environment Variables
Environment variables |
Describe |
Accept_eula |
Accept the SQL Server License Agreement when set to any value (for example, "Y"). |
Mssql_sa_password |
Configure the SA user password. |
Mssql_pid |
Set the SQL Server version or product key. Possible values include the following: Evaluation Development staff Express Web Standard Enterprise Edition Product Key If you specify a product key, it must be formatted as # # # #-# # #-# # #-# # #-# # #, where # is a number or letter. |
Mssql_lcid |
Set the language ID to use for SQL Server. For example 1036 for French. |
Mssql_collation |
Sets the default collation for SQL Server. This overrides the default mapping for the language ID (LCID) of the collation. |
Mssql_memory_limit_mb |
Sets the maximum amount of memory (in megabytes) that SQL Server can use. By default, it is 80% of total physical memory. |
Mssql_tcp_port |
Configures the TCP port that SQL Server listens on (default is 1433). |
Mssql_ip_address |
Set the IP address. Currently, the IP address must be a IPv4 style (0.0.0.0). |
Mssql_backup_dir |
Sets the default backup directory location. |
Mssql_data_dir |
Change the directory where the new SQL Server database data file (. mdf) is created. |
Mssql_log_dir |
Change the directory in which the new SQL Server database log (. ldf) file is created. |
Mssql_dump_dir |
Change the default directory where SQL Server holds memory dumps and other troubleshooting files. |
Mssql_enable_hadr |
Enable the availability group. For example, "1" is enabled and "0" is disabled |
Mssql_agent_enabled |
Enable SQL Server Agent. For example, enable ' true ' and ' false ' are disabled. The proxy is disabled by default. |
Mssql_master_data_file |
Sets the location of the master database data file. |
Mssql_master_log_file |
Sets the location of the master database log file. |
Mssql_error_log_file |
Sets the location of the error log file. |
Example: initial setup
This example runs the mssql-conf setup with the configured environment variables. Specify the following environment variables:
Accept_eula accepts the end User License agreement.
msssql_pid is used in a non-production environment that specifies a free licensed Developer edition of SQL Server.
Mssql_sa_password set a strong password.
mssql_tcp_port Sets the TCP port that SQL Server learns to listen on for 1234 years.
sudo accept_eula= ' Y ' mssql_pid= ' Developer ' mssql_sa_password= ' <yourstrong! Passw0rd> ' mssql_tcp_port=1234/opt/mssql/bin/mssql-conf Setup
Example: Docker
This example Docker command uses the following environment variables to create a new SQL Server 2017 container:
Accept_eula accepts the end User License agreement.
msssql_pid is used in a non-production environment that specifies a free licensed Developer edition of SQL Server.
Mssql_sa_password set a strong password.
mssql_tcp_port Sets the TCP port that SQL Server learns to listen on for 1234 years. This means that instead of mapping port 1433 (the default) to the host port, you must map the custom TCP port with the-P 1234:1234 command in this example.
If you are running Docker on Linux/macos, use the following syntax with single quotes:
Docker run-e accept_eula=y-e mssql_pid= ' Developer '-e mssql_sa_password= ' <yourstrong! Passw0rd> '-e mssql_tcp_port=1234-p 1234:1234-d microsoft/mssql-server-linux:2017-latest
If you are running Docker on Windows, use the following syntax to enclose it in double quotation marks:
Docker run-e accept_eula=y-e mssql_pid= "Developer"-e mssql_sa_password= "<yourstrong! Passw0rd> "-E mssql_tcp_port=1234-p 1234:1234-d microsoft/mssql-server-linux:2017-latest
Configure SQL Server settings with environment variables on Linux