

Keep that in mind if you run into any issues restoring your backup. In the case of the AdventureWorks 2019 backup, the logical names did not match what was expected, so I had to use the FILELISTONLY command on the backup first to determine the logical names. Once it has started, you can execute the SQL command to restore your database and log file. First, you need to make sure that SQL Server has started. With the backup inside the container, you can restore the database. This creates a new directory called backup. You will copy that file into the folder structure for SQL Server.
#Download adventureworks2012 download
Then, download the AdventureWorks2012.bak file and place it in the same directory as Dockerfile. This ensures that file permissions are correctly configured. Now, set the user to the mssql user so that the restore is executed with the user that will be running the SQL Server process. This isn't a production approach and shouldn't be used outside of creating images for testing purposes. We are going to set environment variables for accepting the EULA and setting an SA password. In this example, I'm going to use the /mssql/server:2019-CU5-ubuntu-18.04 image. The first step is to create a Dockerfile and define the base image you want to use. This blog post was written using Docker Desktop for Windows.
#Download adventureworks2012 how to
Learn how to install Docker from the official docs located here. To follow along with this blog post, you just need Docker installed. Let's get started building a AdventureWorks 2019 container. We will be using SQL Server 2019 and the AdventureWorks2019.bak. That left me with restoring from the backups provided. I was initially going to build it from the installations scripts, but there are a few commands in the script that aren't supported on the Linux platform. This need pushed me to create a container with AdventureWorks preconfigured to just spin up a new version when needed and then discard it when I was finished. I typically create an AdventureWorks database since there are plenty of resources for it.


I find myself continually needing a database to execute tests, generate a workload, and more.
