Home » Create a SQL Server 2025 container

Create a SQL Server 2025 container

by Vlad Drumea
0 comments

This post covers creating SQL Server 2025 containers in Podman, Qnap Container Station, and sqlcmd, and restoring a sample database to test the new version.

Prerequisites

For Podman and go-sqlcmd, make sure you have WSL and Podman installed.
You can use the same steps from my Create a SQL Server Developer edition container using sqlcmd post.

For Qnap, you’ll need a Qnap NAS with Container Station installed.

Create a SQL Server 2025 container using the go-based sqlcmd


The good thing about sqlcmd containers is that you can automatically restore a sample database after the container is created. With the downside being that you’re limited to only backup files that are hosted online.

The --collation option can be used to specify a different collation.

Now I can use the following command to get my user’s password and connect via SSMS:


Create a SQL Server 2025 container using Podman

The following command pulls, if not already in your local cache, the latest SQL Server 2025 container image and spins up a container with the following configuration:

  • container name – sql2025
  • hostname – podmansql2025
  • sa password – S0MeP4sS!
  • enable the SQL Server Agent
  • the container’s 1433 TCP port which will be mapped to the host’s 1433 TCP port
  • the F:\ContainerStuff directory in my PC will be mapped to the /var/opt/mssql/my-backups directory inside the container

If you want the container to use another collation, you can specify that using the -e flag and passing "MSSQL_COLLATION=name_of_desired_collation" to it.
Similar to the rest of the environment variables used in the above example.

Note: just like with a normal SQL Server installation, the collation can only be specified during the container’s setup.
It cannot be changed afterwards without re-creating the container.

The complete list of the SQL Server 2025 container’s environment variables and their values can be found here.

I then check the status of the container.


Connect to the instance running in Podman

Now, I can use sqlcmd or SSMS to connect to the instance running inside the newly created container.


Create a SQL Server 2025 container using Qnap’s Container Station

In Qnap Container Station, I go to Images and click on Pull.
In the menu I fill in the link to the desired image and click on Pull.


Once the image is downloaded, I can click on the “Play” button to start the container configuration and creation process.


In the Select Image section, there’s nothing for me to change, so I just click Next.

In the configuration section, I set the same name I used for the Podman example, map the container’s 1433 port to the host’s one.
And then I click on Advanced Settings.


In the Networks section I set the hostname to qnapsql2025, then move on to Environments.


In Environments I specify all the SQL Server related options.
I do this by clicking Add New Variable and then specifying the Variable and its Value.


The variables and their values are as follows:

VariableValue
ACCEPT_EULAY
MSSQL_SA_PASSWORDS0MeP4sS!
MSSQL_AGENT_ENABLED1

Similar to the Podman example, I can use MSSQL_COLLATION to specify a different collation for the container

And this is how the Environment Variables look like.


Afterwards, I click on Storage where I add opt to Bind Mount Host Path.


In order to map the /Container/container-stuff directory on the Qnap NAS to the /var/opt/mssql/my-backups directory inside the container.


Since my NAS is a bit more resource bound than my PC, I’ll also want to limit the resources used by the container.


Once that’s done, I click Apply to be sent back to the first configuration menu and then click Next

I look over the summary to make sure I didn’t miss anything, and then click Finish to create the SQL Server 2025 container.

Now I can check the status of the container.


Connect to the instance running on Qnap Container Station

Once the log stops spooling I can connect to the instance from my PC using SSMS.


Restoring AdventureWorks2022

Note: at the time of writing, there isn’t an AdventureWorks2025 sample database available for download.

For both the Podman and the Qnap containers I just download the AdventureWorks2022.bak file from here, and copy it in the two directories.


Since, internally, both SQL Server 2025 containers have the same directory structure, the following T-SQL will restore the backup.


But you can just as easily use the Restore Database GUI in SSMS.


Conclusion

While go-sqlcmd offers a quick way to create SQL Server 2025 containers, solutions such as Podman and Qnap’s Container Station allow for greater flexibility and more granular configuration options.

An added bonus of using bind mounts to give Podman and Qnap based containers access to directories found on the host is that you can also use them to backup the database(s) you might have worked on inside the containers.
This provides an easy way to move your database between containers/instances.

You may also like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.