As of CTP 2.1 for SQL Server 2017 a set of new environment variables are available. These variables allow us to configure each SQL Server container as we spin them up. The first version of SQL Server on Linux came with:
These had to be set for the container to start. The SA_PASSWORD has be a complex password or the container will not start. CTP 2.1 introduced:
First, I need to pull the latest version of the SQL Server for Linux image.
My run command sets some data directories and a non default port of 6666. I can still use the -p variable to set port mappings for this container. So I will use port 5555 to connect, which will map to the port 6666 that SQL Server is listening on.
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=P455word1' -e MSSQL_BACKUP_DIR=/etc/ -e MSSQL_DATA_DIR=/etc/ -e MSSQL_TCP_PORT=6666 -p 5555:6666 --rm --name mssql1 -d microsoft/mssql-server-linux
Running docker ps shows that my container is running with the ports I specified.
I can check the logs of my container with docker logs mssql1 to see the port it’s listening on.
Lastly I’ll connect with SSMS to check the new default file and backup locations.
This is a very nice addition when running SQL Server on docker, but I’d like to see more. It would be nice to be able to configure Max Memory, TempDB files, MAXDOP, etc. Fingers crossed for the RTM!
The post SQL Server on Docker with new Environment Variables appeared first on The Database Avenger.