You can deploy and run a SQL Server instance on Cloud Containers using the SQL Server Service image.
In this article, we will cover setting up a SQL Server Service Container, and how to access the database. The overall process is:
We have an article on Creating a Container available if you are not familiar with this step. The process is the same for any Service Container. Please specify an SSH Username and SSH Password or associate an existing SFTP user with the Container once it's created. Please note that the existing SFTP user should not be associated with any other containers.
You will need to provide a System Admin password as part of the provisioning process. Please refer to Microsoft's official documentation for more information.
You can choose the version of SQL Server you're running. If you wish to use a paid version of SQL Server, selecting "Product ID" and providing your Product ID in the relevant textbox will allow you to use said version.
Please be aware that the System Admin password can only be modified through the database. This is stored as an environment variable, but you cannot modify the password of a running SQL Server instance just through the environment variable!
You can connect to SQL Server in two ways:
sqlcmd
utility tool.When you SSH into the SQL Server container, you can use the sqlcmd tool located in /opt/mssql-tools/bin/sqlcmd
to access your SQL Server database.
The full command to use is:
/opt/mssql-tools/bin/sqlcmd -S [container name] -U SA -P <YourMSSQLSAPassword>
The container name can be found on your Cloud Container details page.
This will allow you to modify your SQL Server database with Transact-SQL queries. For more information on Transact-SQL, please see Microsoft's official documentation.
You can also connect to your SQL Server container via another container. We recommend using our .NET Core + SDK Web Application to do this. Please note that you will need to publish the relevant port if your Web Container is not on the same server.
In your web-application, you will need to use the internal container name as the host. This can be found on your SQL Server Container details page.
If you have published the 1433 port for SQL Server, you will be able to connect to the SQL Server instance via the SQL Server hostname and published port.
Backups are taken every night of your SQL Server container. They can be found in the same place as all of your other container backups: inside /container/backup/containers
.
To restore the SQL Server backup, you will need to follow the restoration process as outlined here. Please note that if you need to restore the master database for SQL Server, you will need to get in touch with us.
As SQL Server requires a copy of the backup to exist on disk, you will need to copy the relevant backup files onto your container to initiate the backup.