For what it’s worth, SQL should be a little bit easier than solr. This Container really just the base, SQL Image, then the Sitecore SQL Image on top of it. Let’s get cracking! Looking at the docker file in \windows\dependencies\mssql-developer-2017:

You’ll notice a new command in here: HEALTHCHECK. This is used to ensure the Container is running in a valid state. Essentially this does a simple SQL Query to ensure the SQL processes are running. And since this is the base SQL Image, every child image is going to get the same benefit.

Let’s create that image now:

One addition here is the ability to set the memory allocation for the image. This is SQL, so we’ll want to grab some headroom.

Now that we have a SQL Base, let’s throw on some Sitecore SQL on top of it. The Dockerfile is found in \windows\9.x.x\sitecore-xm-sqldev and looks like the following:

Nothing fancy! This is decidedly Sitecore due to the DacPac and WDP references. Also, you’ll see the two custom PS1 files getting copied in.

We’ve got to take note though: the sa password is being set in the sa_password variable. We’ll need the latter to log into SQL if we so desire. Throw it in your password vault, or put it on a sticky note on your monitor. Let’s create this image

Again with the memory option. Also, noting the ASSET_USE_WDP. The path here doesn’t seem to match the local filesystem, so where are they coming from? Look at the ASSET_IMAGE variable there. Notice it points to our original Asset Image? Those files come from that base. Sweet? Hell yeah!

Once that is all said and done, you’ve got your local SQL Image ready to go. Let’s take a look!

Nice Shiny SQL you got there, Paperboy!

Let’s spin up a container using that image:

Similar concepts here compared to solr. We’re opening up port 1433 to our local 44010. We’re mounting a drive, and we’re giving it a name that makes sense for us.

How do you we test? Open up SSMS and connect away! Note below the screenshot. The port is separated from the server name by a comma.

Did you know the comma was for that? TIL

Entering your login information (that lovely Password you snagged from earlier) and viola:

If you’re greeted by an error of “The certificate chain was issued by an authority that is not trusted”, then click the “Options >>” Button, click “Connection Properties” and then check the “Trust server certificate” box like so:

I trust everything, probably.

Once you’ve done that, click Connect. You should see your new server up and running with your Sitecore Databases!

Congrats on your new SQL 2017 Container. If you want to phone mom and dad, that’s great. If you’re Batman, maybe Alfred. Either way, next up is the final piece of the puzzle: Creating the Sitecore CM. Head on over to Part 8: It’s Sitecore Time.

The TL;DR Code

This is a post in the "Yet Another Sitecore Docker Series." Other Posts include