Since September 2019 (09/2019), Sitecore has officially supported running in containers so it’s a good chance for me to play around with Sitecore Docker – an awesome contribution for the Sitecore community by Per Manniche Bering and other contributors.
Personally, I enjoy reading and following the great articles below by Mark Cassidy as they’re very fun and helpful for my own journey as a Docker newbie 😀
- https://intothecloud.blog/2019/09/14/Sitecore-Docker-for-Dummies/
- https://intothecloud.blog/2019/09/16/Setting-up-Sitecore-Docker-Images/
I’ve just purchased a brand new laptop so hopefully I don’t need to install a bulk of software products before launching a Sitecore 9.2 / 9.3 XP instance as usual 😀
Prerequisites
- Windows 10
- Sitecore license
- Note: you can request it via Sitecore free Developer Trial Program
- Docker Desktop
- Sitecore certified account on Sitecore Downloads
- Git for Windows Setup
Step-by-step Set Up
- update Windows 10 to latest version if not yet
- enable Hyper-V + Containers features in Windows and Intel Virtualization (Intel VT) in BIOS if not yet
- do following things so we can play around with command-line much easier
- install chocolatey
- open Windows PowerShell (run as administrator) and then execute Set-ExecutionPolicy -Scope CurrentUser Unrestricted
- install Docker Desktop and Git for Windows Setup
- open Windows PowerShell (run as administrator)
- execute choco install docker-desktop -y
- execute choco install git
- restart Windows, otherwise will see this error message later “The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.”
- ensure using Windows container by navigating to System Tray of Windows taskbar and then clicking on Docker icon + “Switch to Windows containers…” context menu
- otherwise will see this error message later “no matching manifest for linux/amd64 in the manifest list entries”
- create a new folder, let’s say D:\ScDocker
- clone or download the git repo from Sitecore Docker images
- open Windows PowerShell (run as administrator)
- change directory to D:\ScDocker
- execute git clone https://github.com/Sitecore/docker-images.git
- let’s build latest image of Sitecore version on latest LTSC (Long Term Support Channel) Windows version
- open Windows PowerShell (run as administrator)
- change directory to D:\ScDocker\docker-images
- Note: at this moment, the latest Sitecore version is 9.3 and we can use –SitecoreVersion parameter to build image of other versions as well
- Ex: .\build -SitecoreVersion “9.2.0”
- execute .\build and then enter username / password of your Sitecore certified account on Sitecore Downloads
- (optional) in D:\ScDocker\docker-images, create packages folder manually and then copy / paste all the following Sitecore packages are compatible with 9.3 version to “D:\ScDocker\docker-images\packages” folder
- hopefully will see something like this after a loooooooooooog operation
- Note: we should remove unused images (dangling images created during build) as well to save a lot of disk space by executing docker image prune ‐‐force
- ensure that this file C:\license\license.xml is available, otherwise will see this error message later License file is not found. or “License not found at ‘C:\license\license.xml'”
- (optional) let’s spin up Sitecore 9.2.x instances
- open Windows PowerShell (run as administrator)
- change directory to D:\ScDocker\docker-images\windows\tests\9.x.x
- execute docker-compose -f docker-compose.xp.yml up
- (optional) let’s spin up Sitecore 9.3.x instances
- open Windows PowerShell (run as administrator)
- change directory to D:\ScDocker\docker-images\
- execute .\Set-LicenseEnvironmentVariable.ps1 -Path C:\license\license.xml
- change directory to D:\ScDocker\docker-images\windows\tests\9.3.x
- execute docker-compose -f docker-compose.xp.yml up
- let’s see how many containers and their own info by opening another Windows PowerShell (run as administrator)
- execute docker container ls
- have a look at the container of docker image sitecore-xp-standalone:9.3.0-windowsservercore-ltsc2019 and then note its port (it should be 44001)
- open a browser, navigate to http://localhost:44001/
- log into Sitecore (admin / b) and then verify the following ones:
Note: take a look at the following steps to shutdown all the containers
- open Windows PowerShell (run as administrator)
- change directory to D:\ScDocker\docker-images\windows\tests\9.x.x
- execute docker-compose -f docker-compose.xp.yml down
Happy Sitecore Docker!
Good Lord. Maybe NASA can help make setting up Sitecore easier.
LikeLike
Hello,
This is really great article. I also admire you with all your work.
I am following this step by step but when i run script “Build.ps1” it throw me this error. Please suggest me if i have to change anything. I am looking for 9.2 commerce.
Failed: docker image build –isolation ‘hyperv’ –build-arg BASE_IMAGE=mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019 –build-arg ASSETS_IMAGE=sitecore-assets:9.2.0-nanoserver-1809 –build-arg
ASSETS_USE_WDP=’C:\packages\Sitecore 9.2.0 rev. 002893 (XM) (OnPrem)cm.scwdp.zip’ –build-arg SC_ROLE_CONFIG_DIRECTORY=\config\cm –build-arg SC_ROLE_DEFINE=’ContentManagement, Indexing’ –tag ‘sitecore-xm-cm:9.2.0-windowsservercore-ltsc2019’
‘C:\ScDocker\docker-images\windows\9.2.x\sitecore-xm’
At C:\ScDocker\docker-images\modules\SitecoreImageBuilder\1.0.0\Public\Invoke-Build.ps1:234 char:74
+ … here-Object { $ } | ForEach-Object { throw “Failed: $buildCommand” }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Failed: docker ….x\sitecore-xm’:String) [], RuntimeException
+ FullyQualifiedErrorId : Failed: docker image build –isolation ‘hyperv’ –build-arg BASE_IMAGE=mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019 –build-arg ASSETS_IMAGE=sitecore-assets:9.2.0-nanoserver-1809 –build-arg AS
SETS_USE_WDP=’C:\packages\Sitecore 9.2.0 rev. 002893 (XM) (OnPrem)_cm.scwdp.zip’ –build-arg SC_ROLE_CONFIG_DIRECTORY=\config\cm –build-arg SC_ROLE_DEFINE=’ContentManagement, Indexing’ –tag ‘sitecore-xm-cm:9.2.0-windowsservercore-ltsc2019’ ‘C:\S
cDocker\docker-images\windows\9.2.x\sitecore-xm’
Thanks,
Ketan Garala
ketan@addact.in
LikeLike
Hi Ketan,
Just updated this post, please try to execute .\build -SitecoreVersion “9.2.0”
LikeLike
Hello Viet,
Thanks for update. Just for your information i made some changes before run build.ps1.
$BaseTags = “sitecore-9.2ltsc2019″
restore any missing packages
SitecoreImageBuilder\Invoke-PackageRestore
-Path (Join-Path $PSScriptRoot $rootFolder)
-Destination $InstallSourcePath
-SitecoreUsername $SitecoreUsername
-SitecorePassword $SitecorePassword
-Tags $BaseTags
-ExperimentalTagBehavior:(@{$true = “Include”; $false = “Skip” }[$IncludeExperimental -eq $true]) `
-WhatIf:$WhatIfPreference
start the build
SitecoreImageBuilder\Invoke-Build
-Path (Join-Path $PSScriptRoot $rootFolder)
-InstallSourcePath $InstallSourcePath
-Registry $Registry
-Tags $BaseTags
-ExperimentalTagBehavior:(@{$true = "Include"; $false = "Skip" }[$IncludeExperimental -eq $true])
-IsolationModeBehaviour $IsolationModeBehaviour `
-WhatIf:$WhatIfPreference
Is it fine? or should i run your given command .\build -SitecoreVersion “9.2.0”?
Thanks,
Ketan Garala
LikeLike
Hello Viet,
Sorry for to many reply. i need one more help. Can I build only XP and XC (Not XM) images? If some how i can edit script then let me know?
Thank You!
Thanks,
Ketan Garala
LikeLike
Hi Ketan,
My suggestion is to use the default “Build.ps1” file and then try to execute .\build -SitecoreVersion “9.2.0” -Topology “xc”
By the way, you can play around with some other parameters as well (they’re in Build.ps1) outside SitecoreVersion / Topology
LikeLiked by 2 people
Hello Viet,
Thanks for your help. I will execute .\build -SitecoreVersion “9.2.0” -Topology “xp” and execute .\build -SitecoreVersion “9.2.0” -Topology “xc”
Thanks again for great help.
Thanks,
Ketan Garala
LikeLiked by 1 person
Any ideas as to why I am getting the error listed below
Failed: docker image build –isolation ‘hyperv’ –memory 4GB –build-arg BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2019 –tag ‘mssql-developer:2017-windowsservercore-ltsc2019’
‘C:\ScDocker\docker-images\windows\dependencies\mssql-developer-2017′
At C:\ScDocker\docker-images\modules\SitecoreImageBuilder\1.0.0\Public\Invoke-Build.ps1:234 char:74
+ … here-Object { $_ } | ForEach-Object { throw “Failed: $buildCommand” }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Failed: docker …developer-2017’:String) [], RuntimeException
+ FullyQualifiedErrorId : Failed: docker image build –isolation ‘hyperv’ –memory 4GB –build-arg BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2019 –tag ‘mssql-developer:2017-windowsservercore-ltsc2019’
‘C:\ScDocker\docker-images\windows\dependencies\mssql-developer-2017’
LikeLike
I’m getting the same, did you find a solution?
LikeLike
I managed to fix this issue by changing IsolationModeBehaviour to ForceProcess in Build.psi (l.40)
LikeLike
Thanks for keeping us updated. Could you please create a Pull Request for that in https://github.com/Sitecore/docker-images?
LikeLike
This fixed the Hype-V error but now I am running into a new error
Failed: docker image build –memory 4GB –build-arg BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2019 –tag
‘mssql-developer:2017-windowsservercore-ltsc2019’ ‘C:\ScDocker\docker-images\windows\dependencies\mssql-developer-2017′
At C:\ScDocker\docker-images\modules\SitecoreImageBuilder\1.0.0\Public\Invoke-Build.ps1:234 char:74
+ … here-Object { $_ } | ForEach-Object { throw “Failed: $buildCommand” }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Failed: docker …developer-2017’:String) [], RuntimeException
+ FullyQualifiedErrorId : Failed: docker image build –memory 4GB –build-arg BASE_IMAGE=mcr.microsoft.com/windows
/servercore:ltsc2019 –tag ‘mssql-developer:2017-windowsservercore-ltsc2019’ ‘C:\ScDocker\docker-images\windows\de
pendencies\mssql-developer-2017’
Any thoughts?
LikeLike
Hi,
After running these docker locally, how can I deploy these docker images on AWS EKS. Any blog/reference would really help. Eventually what I am trying to deploy Sitecore Docker on AWS EKS.
Thanks
Sandeep
LikeLike
Highly recommend you to join Sitecore Slack: https://sitecorechat.slack.com/ (especially “docker” channel, you can register here https://docs.google.com/forms/d/e/1FAIpQLScsJX9PC3m8u-labRn_BNnByR0aiAxPYowN-doed6_t45aPhg/viewform) and then post your query there
LikeLike
Hi Viet,
Thanks ,I have registered on slack. Awaiting their approval email. Meanwhile working on your steps and when I am building the 9.3 with command “.\build -SitecoreVersion “9.3.0” I am getting below error after long wait. Seems like the issue with database. Any idea why I am getting this error or should I move with next step of docker creation
The command ‘powershell -Command $ErrorActionPreference = ‘Stop’; $ProgressPreference = ‘SilentlyContinue’; New-Item -Path ‘C:\install’ -ItemType ‘Directory’ | Out-Null; curl.exe -sS -L -o C:\install\SQL.exe ‘https://go.microsoft.com/fwlink/?linkid=840945’; curl.exe -sS -L -o C:\install\SQL.box ‘https://go.microsoft.com/fwlink/?linkid=840944’; Start-Process -FilePath ‘C:\install\SQL.exe’ -ArgumentList ‘/qs’, ‘/x:C:\install\setup’ -NoNewWindow -Wait; Start-Process -FilePath ‘C:\install\setup\setup.exe’ -ArgumentList ‘/q’, ‘/ACTION=Install’, ‘/INSTANCENAME=MSSQLSERVER’, ‘/FEATURES=SQLEngine’, ‘/UPDATEENABLED=0’, ‘/SQLSVCACCOUNT=\”NT AUTHORITY\System\”‘, ‘/SQLSYSADMINACCOUNTS=\”BUILTIN\ADMINISTRATORS\”‘, ‘/TCPENABLED=1’, ‘/NPENABLED=0’, ‘/IACCEPTSQLSERVERLICENSETERMS’ -NoNewWindow -Wait; Stop-Service MSSQLSERVER; Set-ItemProperty -Path ‘HKLM:\software\microsoft\microsoft sql server\mssql14.MSSQLSERVER\mssqlserver\supersocketnetlib\tcp\ipall’ -Name ‘tcpdynamicports’ -Value ”; Set-ItemProperty -Path ‘HKLM:\software\microsoft\microsoft sql server\mssql14.MSSQLSERVER\mssqlserver\supersocketnetlib\tcp\ipall’ -Name ‘tcpport’ -Value 1433; Set-ItemProperty -Path ‘HKLM:\software\microsoft\microsoft sql server\mssql14.MSSQLSERVER\mssqlserver’ -Name ‘LoginMode’ -Value 2; curl.exe -sS -L -o C:\install\DacFramework.msi ‘https://download.microsoft.com/download/9/2/2/9228AAC2-90D1-4F48-B423-AF345296C7DD/EN/x64/DacFramework.msi’; Start-Process -FilePath ‘msiexec.exe’ -ArgumentList ‘/i’, ‘C:\install\DacFramework.msi’, ‘/quiet’, ‘/norestart’ -NoNewWindow -Wait; Remove-Item -Path ‘C:\install’ -Recurse -Force;’ returned a non-zero code: 1
Failed: docker image build –isolation ‘hyperv’ –memory 4GB –build-arg BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2019 –tag ‘mssql-developer:2017-windowsservercore-ltsc2019’
‘C:\Sandeep\Personal\SitecoreDockerisation\ScDocker\docker-images\windows\dependencies\mssql-developer-2017′
At C:\Sandeep\Personal\SitecoreDockerisation\ScDocker\docker-images\modules\SitecoreImageBuilder\1.0.0\Public\Invoke-Build.ps1:234 char:74
+ … here-Object { $_ } | ForEach-Object { throw “Failed: $buildCommand” }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Failed: docker …developer-2017’:String) [], RuntimeException
+ FullyQualifiedErrorId : Failed: docker image build –isolation ‘hyperv’ –memory 4GB –build-arg BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2019 –tag ‘mssql-developer:2017-wi
ndowsservercore-ltsc2019’ ‘C:\Sandeep\Personal\SitecoreDockerisation\ScDocker\docker-images\windows\dependencies\mssql-developer-2017’
LikeLike
Hi Sandeep, you may want to try the solution here https://github.com/Sitecore/docker-images/issues/186
Or open “Docker Desktop -> Settings -> Docker Engine” and then add the setting “dns”: [“8.8.8.8”]
LikeLiked by 1 person
Hi Viet,
I am getting following error. It’s looking for some executable SQL.exe in install folder. Do I need to pre set something for this before executing the build command?
curl: (6) Could not resolve host: go.microsoft.com
curl: (6) Could not resolve host: go.microsoft.com
Start-Process : This command cannot be run due to the error: The system cannot
find the file specified.
At line:1 char:319
+ … id=840944′; Start-Process -FilePath ‘C:\install\SQL.exe’ -ArgumentL …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOp
erationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.C
ommands.StartProcessCommand
LikeLike
I had same issue was fixed using Ethernet connection instead WiFi https://github.com/Sitecore/docker-images/issues/186
LikeLiked by 2 people
Hi Juan, thanks for keeping us updated 🙂
LikeLike
Great Article,
Thanks for sharing. One question, as Sitecore docker repository is having limited images, any idea about Sitecore 9.1.0 with XP Scaled image?
LikeLike
I guess that you will have to build Sitecore 9.1.0 docker images by yourself as there is only 9.1.1 version on https://github.com/Sitecore/docker-images/blob/master/build/IMAGES.md
LikeLiked by 1 person
Hello, just found out https://github.com/Sitecore/docker-images/tree/master/build/legacy/images/9.1.0%20rev.%20001564 so you may want to give it a shot
LikeLike