Skip to main content

Sitecore

Local Docker Environment Setup with Sitecore 10.3 and SXA

Shot Of Two Young Technicians Using A Digital Tablet While Working In A Server Room

We as developers/consultants set up our local Sitecore instances for our project developments, some are simple and easy, and some are complex and take time as you may come across errors. Now, as Sitecore is moving towards headless and containerized solutions, the way how to get local development instances up and running has changed from what had to be done for on-prem instances.

Starterkit Pre-requisites

Recently, I was trying to set up my local instance for the Starterkit (Next.js SDK and Headless SXA) which Martin Miles mentioned here in his blog post, and I was thinking of sharing the steps involved and the errors that I have faced during the process, so it might save some of your time. The Starterkit created in that blog is added to source control which had to be cloned to start working. But first, make sure that you have all the pre-requisites: 

  • NodeJs 16.x 
  • .NET 6.0 SDK 
  • .NET Framework 4.8 SDK 
  • Visual Studio 2019/2022 
  • Docker for Windows, with Windows Containers, enabled 
  • Hyper-v  

After cloning a SitecoreHeadlessStarterKit repository in my local machine, the next step was to spin a Docker instance. Docker needs to be set as Windows Container, in my case, it was set as a Linux container by default.

Before running the first command, make sure that the Sitecore license is placed in the correct folder on your local machine.

Opening a Windows PowerShell in Administrator mode and go to the folder where is SitecoreHeadlessStarterKit located on your local machine.

Running the command .\init.ps1 -InitEnv -LicenseXmlPath "C:\path\to\license.xml" -AdminPassword "DesiredAdminPassword" -Topology xp0  with your updated password and license location.

SitecoreHeadlessStarterKit

The building process can take some time, in my case it took a few hours and yet there were some errors because one key step is skipped.
The first error was that the process cannot access the file, because it is being used by another process and my local IIS is listening on port 443.

local IIS is listening on port 443

To solve this error a command iisreset /stop needs to be ran in Administrator mode Command Prompt:

Iisreset Stop

Now the Sitecore Environment is Successfully Started. Sitecore environment is successfully started

After completing this environment preparation, run the command \up.ps1

There was a New Error:  a new error

To check which versions of the .NET SDK are currently installed in Windows PowerShell a command dotnet --list-sdks is used and a command dotnet tool restore to Install the .NET local tools that are in scope for the current directory

dotnet tool restore

After Sitecore environment preparation is completed run the command .\up.ps1

This process can take quite some time to complete.  

Sitecore environment preparation is completed

Device Authorization

Now, a new window in your browser should open and accept the device authorization which will lead, after acceptance, to opening a Sitecore Launchpad. After successfully setting up a local docker environment with 10.3 and SXA, we can explore more Sitecore. 

Sitecore Launchpad

For starting the project next time, we need to run again the command  .\up.ps1 in Windows PowerShell in administrator mode and again in the browser to accept the device authorization which will lead, after acceptance, to opening the Sitecore Launchpad. 

Hope you find this blog post helpful in setting up a local docker environment with Sitecore 10.3 and SXA.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Kristina Mitrovic

Kristina has an MSc in Electrical Engineering and Computer Science and works in Perficient as a Business Consultant in Sitecore / Optimizely Business Unit. She is enthusiastic and endlessly curious about innovative tech and business solutions. She joined Perficient in January 2022. In her free time, she is painting and exhibiting paintings, practicing archery, playing piano, hiking, or traveling.

More from this Author

Follow Us