No subscription required
This is part 2 in a series about Sitecore and Docker.
- Part 1: Docker for Dummies - Docker 101 or Docker basics…
- Part 2: Docker for Dummies - Setting Up Sitecore Docker Images
- Part 3: Docker for Dummies - Deploying and Debugging your Visual Studio Solutions (using Sitecore and Docker)
Keep in mind that most everything I write in these posts is simplified in one way or another. I figure; you either know more than me already - in which case you have no use for these posts. Or you’re like me - just starting out - in which case I can tell you, I didn’t need to know so it’s likely you won’t need to know either.
Assuming you’re done playing with WordPress, I figure it’s time to get busy with some Sitecore. Having read various other “Getting started with Docker/Sitecore” posts out there, let me start by making a few things clear that caught me when I first began my journey.
- No service subscription is reqiured. Not to Docker Hub, not to Azure, not anywhere.
- This will not eat up all your precious disk space.
There are a few things that are required however, and there’s nothing I can do about that.
- You will need to be a certified Sitecore developer with access to download from https://dev.sitecore.net/.
- You need a valid
license.xmlfile for Sitecore
- You need to have Git installed.
Last post we asked Docker for some images (for MySql and WordPress) and we launched up our containers using these images. If I was to write in detail about what an image is, this would no longer be a For Dummies approach to Docker. So instead, think of images like this.
- OS Layer (Operating System)
- Web Server Layer
- .NET Layer
- Sitecore Base Layer
- Sitecore XP Layer
- Sitecore ContentDelivery Layer
Each image (layer) has a dependency up the chain and is the diff between the dependencies and it’s current state. So you have an OS layer (Windows, Linux, whatever) and you then pile on top of this to get to where you want. Not entirely unlike how you pile up stuff on your newly installec PC when you first boot it up.
Ok so it’s really nothing like that, but it works as an abstraction. And is good enough to move on with.
What may not have been obvious (because we didn’t actually care or need to know), is that when we did the WordPress example, there were dependencies involved. It’s not like MySql and WordPress can run entirely without some kind of host. I don’t actually know or care which exactly, but I’ll bet there was some Linux involved.
With Sitecore - as you know - Linux will not get us going. At least not fully. We need Windows images and containers, and for that we need to tell Docker to switch mode from it’s Linux default.
Find Docker Desktop in your taskbar and make it switch to Windows containers (already done in this screenshot). Docker will restart and that will be that.
We also can’t download Sitecore images freely, like we could with WordPress. Bummer. I won’t get into this discussion here. But we’re going to have to build these images ourselves.
We’re now ready to build some Windows based images for Sitecore. So let’s get to it.
Make no mistake, it is a significant amount of work, to configure and set up an environment to build these images. Fortunately for me and fortunately for us, there are already some enthusiastic community members doing a pile of this work for us. Give a shoutout to pbering and jeanfrancoislarente if you come across them for all the work they’ve just saved you from.
Open up your favourite command prompt and execute the following:
git clone https://github.com/Sitecore/docker-images.git
A few words before you continue. This repository can build you Sitecore images for every version from 7.5 and up. I know, because that’s how I started :P And while that is all fine and well, it is likely
a) not necessary
b) too time consuming
So don’t do that. I don’t mean “have a bit of patience” type time consuming btw, I mean “1-2 days” time consuming. I don’t know exactly how long it takes to build the entire set of images, since I had to restart a few times. And I was also caught in the “you need a registry account” falsum so lots of time was spent waiting for pointless uploads.
Anyway. Pretty much all of the work is done for you. All you need to do, is set up a build script. Copy this, and paste it into a file you call
This is a slightly modified version of the original, found in the repository.
In all this, there are only 3 lines you need to modify.
Replace these variable values to fit your needs. Dump your license XML file into $installSourcePath, and put your Sitecore SDN user credentials (the account you can download with) into $sitecoreUsername and $sitecorePassword.
In this configuration, you’re set to build any and all Sitecore 9.2 versions and variants. That’ll do for now.
Let’s get this show on the road. (Make sure you have your license.xml in place)
And off it goes. If there is interest, I could go into greater detail in a separate post about what happens now - but you don’t really need to worry much about it. Suffice it to say, the script now gets busy downloading Sitecore releases and building images based on them. It will pull in base images as neeeded (for windows and sql server and so on). Sit back and relax.
Depending on PC spec and network speed, this will take anywhere from 10 minutes to.. I guess an hour or so. Assuming you end up with green text, all is well and we’re ready to finally get to the good stuff.
Right. The time for WordPress is over. Let’s do this. Thanks to the aforementioned Docker heroes, your hello world will be as effortless as previous examples. But instead of… yea… let’s go crazy and fire up a full scaled Sitecore XP. Complete with xconnect index processors and everything. Heck, let’s throw some SXA on it as well (which then obviously includes Sitecore PowerShell Extensions 5.0 and JSS 12).
Too much? not at all. Child’s play.
cd '.\tests\9.2.0 rev. 002893\windowsservercore\'
docker-compose -f docker-compose.xp.sxa.yml up
And your console is about to get very busy. It opens up like this.
Give it a short while if this is your very first run (might need a minute or two).
But don’t wait too long; “smiling asian lady” is waiting for you on
http://localhost:44001. Go say hi 😎
If (when) you want to log into Sitecore itself, go to
http://localhost:44001/sitecore and log in with the trusted
That’s it. No seriously. Well almost.
Just two small things to do; we need to get your Solr properly initialised. Open up Control Panel -> Indexing and execute the two following tasks:
- Populate Solr Managed Schema (all indexes)
- Indexing Manager -> Rebuild all indexes
Open up a new PowerShell (your old one is busy). A few commands of interest.
docker container ls
Will give you a list of the XP instance containers you just brought to life.
None of these containers have any sort of UI. But you can connect to the SQL server using SMSS as if it was any other SQL server. You can browse to
http://localhost:44002 to find your CD server. You can even start a PowerShell inside it. Grab the CONTAINER ID for
sitecore-xp-sxa-1.9.0-cd:9.2.0-windowsservercore-1903 and do
docker exec -it 8d0502d19b42 powershell (replace with your own id)
And off you go.
(a look inside your CD container)
exit when you want to return to your host PowerShell session.
Once you’re ready to let go, you can tear all of this down again. Type in:
docker-compose -f .\docker-compose.xp.sxa.yml down
And Docker will proceed to tear down all the containers.
Done 😎 No resdiual Solr installs, no leftover databases, no resources being consumed. It’s gone (sort of, more on that next time), until you call it all up again :-)
I think that’s enough for now. Until next time.