| title | Configure SQL Server settings with environment variables | Microsoft Docs |
|---|---|
| description | This topic describes how to use environment variables to configure specific SQL Server 2017 settings on Linux. |
| author | rothja |
| ms.author | jroth |
| manager | jhubbard |
| ms.date | 05/22/2017 |
| ms.topic | article |
| ms.prod | sql-linux |
| ms.technology | database-engine |
| ms.assetid |
You can use several different environment variables to configure SQL Server 2017 CTP 2.1 on Linux. This topic provides a list of the settings that are configurable using environment variables.
Important
At this time, the environment variables only configure SQL Server running in Docker. To configure the SQL Server service outside of a Docker scenario, see Configure SQL Server on Linux with the mssql-conf tool.
| Environment variable | Description |
|---|---|
| ACCEPT_EULA | Accept the SQL Server license agreement when set to any value (for example, 'Y'). Used on first install only. |
| SA_PASSWORD | Configure the SA user password. Used on first install only. |
| MSSQL_TCP_PORT | Configure the TCP port that SQL Server listens on (default 1433). |
| MSSQL_IP_ADDRESS | Set the IP address. Currently, the IP address must be 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 files (.mdf) are created. |
| MSSQL_LOG_DIR | Changes the directory where the new SQL Server database log (.ldf) files are created. |
| MSSQL_DUMP_DIR | Change the directory where SQL Server will deposit the memory dumps and other troubleshooting files by default. |
| MSSQL_ENABLE_HADR | Enable Availability Groups. |
The following docker run command uses MSSQL_TCP_PORT to set the TCP port that SQL Server listens on. In this case, the host port mapping must that this new port into consideration. Instead of mapping port 1433 (default) to a host port, the custom TCP port must be mapped (1234 in this example).
docker run -e ACCEPT_EULA=Y -e SA_PASSWORD='<YourStrong!Passw0rd>' -e MSSQL_TCP_PORT=1234 -p 1234:1234 -d microsoft/mssql-server-linuxFor other SQL Server settings not listed here, see Configure SQL Server on Linux with the mssql-conf tool.
For more information on how to install and run SQL Server on Linux, see Install SQL Server on Linux.