docker

Playing around with the set-up of Sitecore Docker Images

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 😀

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

Step-by-step Set Up

  1. update Windows 10 to latest version if not yet
  2. enable Hyper-V + Containers features in Windows and Intel Virtualization (Intel VT) in BIOS if not yet
  3. 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
    • sc9_14
  4. install Docker Desktop and Git for Windows Setup
    • open Windows PowerShell (run as administrator)
    • execute choco install docker-desktop -y
    • dk_1
    • execute choco install git
    • dk_2
  5. 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.”
    • dk_6
  6. ensure using Windows container by navigating to System Tray of Windows taskbar and then clicking on Docker icon + “Switch to Windows containers…” context menu
    • dk_7
    • otherwise will see this error message later “no matching manifest for linux/amd64 in the manifest list entries”
    • dk_8
  7. create a new folder, let’s say D:\ScDocker
  8. clone or download the git repo from Sitecore Docker images
  9. 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
    • dk_4
    • (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
    • msdf26_2
    • hopefully will see something like this after a loooooooooooog operation
    • msdf26_3
    • 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
    • This slideshow requires JavaScript.

  10. 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'”
    • This slideshow requires JavaScript.

  11. (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
    • dk_11
  12. (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
    • dk_20.png
  13. let’s see how many containers and their own info by opening another Windows PowerShell (run as administrator)
    • execute docker container ls
    • dk_21
    • 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)
  14. open a browser, navigate to http://localhost:44001/
    • dk_13
  15. log into Sitecore (admin / b) and then verify the following ones:
    • This slideshow requires JavaScript.

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
  • dk_18

Happy Sitecore Docker!

24 thoughts on “Playing around with the set-up of Sitecore Docker Images

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

    Like

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

        Like

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

        Like

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

        Liked by 2 people

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

        Liked by 1 person

  2. 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’

    Like

      1. 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?

        Like

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

    Like

  4. 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’

    Like

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

    Like

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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