sql-serverdockercollationsql-server-collation

Specify Collation in Docker installation


I've used this guide to install on . However, the default collation it sets up is not the one I require. Is there a way to specify the desired collation during the installation process without having to change it afterwards? Thanks.

I don't know how to specify the collation I want: SQL_Latin1_General_Pref_CP850_CI_AS.


Solution

  • SQL Server in Docker and Linux can be configured using environment variables. Use MSSQL_COLLATION to specify the desired collation:

    sudo docker run -e "ACCEPT_EULA=Y" \
        -e "MSSQL_SA_PASSWORD=<YourStrong@Passw0rd>"
        -e "MSSQL_COLLATION=SQL_Latin1_General_Pref_CP850_CI_AS" \
        -p 1433:1433 --name sql1 --hostname sql1 -d mcr.microsoft.com/mssql/server:2022-latest