Configure SQL Server settings with environment variables on Linux

Omar Navarro 326 Reputation points
2022-04-22T22:15:05.723+00:00

This error has appeared after installing SQL Server 2017 on Linux via Docker container. The error inconsistently occurs at various Virtual Machines.

195669-intialize-docker.png

sql-server-linux-configure-environment-variables

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
525 questions
{count} votes

Accepted answer
  1. Sander van de Velde 27,186 Reputation points MVP
    2022-04-23T17:10:41.567+00:00

    Hello @Omar Navarro ,

    I have used Sql Server on the edge in the past.

    Your Container Create Options look like this:

    {  
        "Env": [  
            "ACCEPT_EULA=Y",  
            "SA_PASSWORD=${SaPassword}"  
        ],  
        "HostConfig": {  
            "LogConfig": {  
                "Type": "json-file",  
                "Config": {  
                    "max-size": "10m",  
                    "max-file": "3"  
                }  
            },  
            "Binds": [  
                "${bindMount}"  
            ],  
            "PortBindings": {  
                "00000/tcp": [  
                    {  
                        "HostPort": "00000"  
                    }  
                ]  
            }  
        }  
    }  
    

    It seems your password has not been merged yet.

    My solution looked like this:

    {  
      "Env": [  
        "ACCEPT_EULA=Y",  
        "MSSQL_SA_PASSWORD=p@ssw0rd!Sql"  
      ],  
      "HostConfig": {  
        "PortBindings": {  
          "1433/tcp": [  
            {  
              "HostPort": "1401"  
            }  
          ]  
        },  
        "Mounts": [  
          {  
            "Type": "volume",  
            "Source": "sqlVolume",  
            "Target": "/var/opt/mssql"  
          }  
        ]  
      }  
    }  
    

    Notice I use a 'Mount' instead of a 'Bind'. (technically, this is just another notation for the same folder access solution).

    Also, check out the port mapping.

    Can you try this notation? Does it work for you?


1 additional answer

Sort by: Most helpful
  1. YufeiShao-msft 7,046 Reputation points
    2022-04-25T07:13:13.003+00:00

    Hi @Omar Navarro

    About you error:

    Error: 49940, Severity: 16, State: 1.Unable to open one or more of the user-specified certificate file(s). Verify that the certificate file(s) exist with read permissions for the user and group running SQL Server

    Try to set up with an SSL certificate following this article:
    Encrypting Connections to SQL Server on Linux
    and be careful to have the permission of the path of the folder where the certificate file is located.

    https://stackoverflow.com/questions/56619361/sql-server-service-breaks-after-adding-ssl-certificates-in-linux
    https://stackoverflow.com/questions/67490566/unable-to-debug-sql-server-docker-container-ssl-certificate-issues

    -------------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments