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.

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:pathtolicense.xml” -AdminPassword “DesiredAdminPassword” -Topology xp0

 with your updated password and license location.

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.

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

Now the Sitecore environment is successfully started.

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

There was 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

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

This process can take quite some time to complete.  

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. 

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 authorisation 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.