Running Express Edition in a Container–#SQLNewBlogger

Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

Recently I was looking through the forums and someone had a question on JSON and the Express edition of SQL Server 2019. I was sure JSON worked, but I also didn’t have Express set up on my machine. I decided a container would be a quick way to test this.

I’ve started lots of containers, but I rarely do anything other than the Developer edition. I know you can set the edition, but didn’t know how, so I had to look it up. This post covers the quick way to do this.

Environment Variables

There are a lot of environment variables that we can use to configure containers, and SQL Server in particular. There are two that are required:

  • ACCEPT_EULA
  • SA_PASSWORD (or MSSQL_SA_PASSWORD)

These two need to be supplied to start the container. Beyond that, you can add others that are useful for you.

To run as Express, you will want to MSSQL_PID variable, which can be set to any of these:

  • Evaluation
  • Developer
  • Express
  • Web
  • Standard
  • Enterprise
  • A product key

For my situation, this means I run Express like this:

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=password" -e "MSSQL_PID=Express" -p 51433:1433 --name express2019 -h express2019 -d mcr.microsoft.com/mssql/server:2019-CU7-ubuntu-16.04

This starts up a new container, and I can connect, where I’ll see the correct version.

2020-09-14 11_15_49-SQLQuery2.sql - .,51433.master (sa (55))_ - Microsoft SQL Server Management Stud

SQLNewBlogger

It took me about 5 minutes to get this working, and then it was a question of writing this post and capturing an image. I had the code, because I’d just used it.

Overall, a good way to show a few things about containers and SQL Server, and a skill that an interviewer might ask about.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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