Starting with Sitecore Experience Platform 10.0, Docker support has become standard. In this article, we will show you how to run Sitecore Experience Platform 10.0 with Docker.
![](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F40lj5V59ACUCkq4MsVx3cb%2Fad2bef7d4abdbef5d5924a3f0879e614%2Flaunchpad.png&w=3840&q=75)
- Docker-related articles are summarized in Docker.
Prerequisite
To create a demo environment, we will use the following software. The editor can be set up as you like, but here we will install Visual Studio Code.
- Windows Server 2019
- Chocolatey
- Visual Studio Code
- Git for Windows
- Docker Desktop
Windows Server 2019 Setup
For this environment, we prepared a virtual machine that can use Docker to start up on Microsoft Azure. The instance used this time is Standard D8s v3 (8 vcpu, 32 GiB memory). We have already translated the administration screen into Japanese so that it is easy to refer to the explanation.
Change the security of the server in Windows Server 2019 so that files can be downloaded and installed from the Internet. Select Server Manager, specify local server, and with respect to administrators, turn off the Internet Explorer security feature to allow downloading.
![servermanager.gif](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F2ShoDw2Wt1rwN8btefBqwh%2F096cfe234330be35602eadd094e30fac%2Fservermanager.gif&w=3840&q=75)
When Internet Explorer is launched, a dialog box appears regarding the protected mode.
![internetexplorer.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F5juRzafI7rHfh9TBwaUUkw%2F58cf97585b0336b6baf79ec5ab76d1d1%2Finternetexplorer.png&w=3840&q=75)
Turn it on here. Make sure that Google Chrome has been downloaded and installed in this state.
Enabling Hyper-V
Docker uses Hyper-V when using Windows containers. For this reason, Hyper-V must be enabled. To do so, launch the Server Manager and enable Hyper-V and containers.
![hyperv.gif](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2FVALDJo0fw4oCUa3aVg393%2F2b02dc4f2756858eedd853dc9813b0b8%2Fhyperv.gif&w=3840&q=75)
In order to enable Hyper-V, the machine must be rebooted, so we will reboot it once and continue with the rest of this section.
Installing Choco
Install Chocolatey, a package management tool, as it is useful for installing various software.
Click the Install Now button in the upper right corner of the page to display the script. Running the script with PowerShell administrative privileges will complete the installation.
After the installation is complete, first install Git and vscode.
choco install git
choco install vscode
![chocogitvscode.gif](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F1n5VmCU3RJrQ4F2E8cj7lW%2F052222c93173e4de69381a8fc2254669%2Fchocogitvscode.gif&w=3840&q=75)
As for VS Code, it is useful to install an additional Japanese UI.
Docker Desktop
Docker Desktop can also be installed from the command line.
choco install docker-desktop
The installation will install the required components and prompt for a reboot if necessary (the following steps require a reboot).
![dockerdesktop.gif](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F1SzyUcpb4o2DdOhf7Qm5PC%2Fb8baba0f5f7d8c7c71a141aa2c0a8562%2Fdockerdesktop.gif&w=3840&q=75)
Once logged in, you will see docker running in the task tray in the lower right corner.
![dockerdesktop.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2FAZIMpLmoZCJLqMZLgLSIE%2Fee9b59609b078f903a1f09187a180779%2Fdockerdesktop.png&w=1920&q=75)
Right-click on the icon to switch to the Windows container.
![switchwindows.gif](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F4yNWdPaiEcNpEsIGWrY1Wn%2F58dcd339c21685af6ea15a1d3450dbef%2Fswitchwindows.gif&w=3840&q=75)
A dialog box appears as shown below to switch between the two.
![switchwindows.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F5HQCv3jwxoQCBRXkybocGN%2F8436bc474caa24a7731824d19d12940b%2Fswitchwindows.png&w=3840&q=75)
Install the Sitecore Docker Tool
A useful tool to assist with installation is the Sitecore Docker Tools, which can be downloaded from the Sitecore Gallery and installed by executing the following commands.
Register-PSRepository -Name "SitecoreGallery" -SourceLocation "https://sitecore.myget.org/F/sc-powershell/api/v2"
Install-Module SitecoreDockerTools
When confirmation comes at the command prompt, use Y or A to proceed.
![sitecoredockertools.gif](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2Fh7CI4JML2bVYEhZrZODQs%2Fd65926c4814b39ecc1cbabb6bbdf39bb%2Fsitecoredockertools.gif&w=3840&q=75)
Start preparing for installation
After all the tools have been prepared, we will proceed with the installation while using the tools.
Prepare package for deployment
For the deployment package required for installation, download the Container Deployment Package from the Sitecore Experience Platform 10.0 site.
![deploymentpackage.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F5ZlhEDnoWrDojgeu156xqT%2F071d20daa7fc11ff0965eceb9153d452%2Fdeploymentpackage.png&w=3840&q=75)
The file name downloaded this time is SitecoreContainerDeployment.10.0.0.004346.184.zip. This file was unzipped to c:\projects and the folder structure is as follows.
![projectfolder.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2FDT0j8HbGHyfALwK9gzysS%2Fc46fcee1cdc7dabc60ef1f7aa2f7fac8%2Fprojectfolder.png&w=3840&q=75)
Two folders are prepared in the folder: the compose folder and the k8s folder. In this case, we will use ltsc2019 - xp0 in the compose folder since we only want to run it at hand.
Prepare license file
Prepare the sitecore license file. This time, copy the file to the folder c:\projects created above.
![license.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F4hJmRKgDVK4mO0N5BosGTf%2F324d746d143c862b348b0caadfa149b0%2Flicense.png&w=3840&q=75)
Environment setting
In order to deploy xp0, we will work in the c:\projects\compose\ltsc2019\xp0 folder.
This folder contains only the .env file and docker-compose.yml file. In order to create the Sitecore environment to be launched this time, we will set the values in the .env file.
If you check the file, you will see the following
COMPOSE_PROJECT_NAME=sitecore-xp0
SITECORE_DOCKER_REGISTRY=scr.sitecore.com/sxp/
SITECORE_VERSION=10.0.0-ltsc2019
SITECORE_ADMIN_PASSWORD=
SQL_SA_PASSWORD=
TELERIK_ENCRYPTION_KEY=
SITECORE_IDSECRET=
SITECORE_ID_CERTIFICATE=
SITECORE_ID_CERTIFICATE_PASSWORD=
SITECORE_LICENSE=
CM_HOST=xp0cm.localhost
ID_HOST=xp0id.localhost
TRAEFIK_IMAGE=traefik:v2.2.0-windowsservercore-1809
TRAEFIK_ISOLATION=hyperv
ISOLATION=default
The project name is sitecore-xp0 and the Docker registry is the image provided by Sitecore. The standard parameters are set, but you will need to fill in the blanks.
Parameter | Value |
---|---|
COMPOSE_PROJECT_NAME | sitecore-xp0 |
SITECORE_DOCKER_REGISTRY | scr.sitecore.com/sxp/ |
SITECORE_VERSION | 10.0.0-ltsc2019 |
SITECORE_ADMIN_PASSWORD | |
SQL_SA_PASSWORD | |
TELERIK_ENCRYPTION_KEY | |
SITECORE_IDSECRET | |
SITECORE_ID_CERTIFICATE | |
SITECORE_ID_CERTIFICATE_PASSWORD | |
SITECORE_LICENSE | |
CM_HOST | xp0cm.localhost |
ID_HOST | xp0id.localhost |
TRAEFIK_IMAGE | traefik:v2.2.0-windowsservercore-1809 |
TRAEFIK_ISOLATION | hyperv |
ISOLATION | default |
SITECORE_ADMIN_PASSWORD
Set a password to be used by the Sitecore administrator. For this reason, please set a password that is used by a general administrator.
SQL_SA_PASSWORD
Set the password that SQL Server will use. In this case, we will use a tool to set the password.
Set-DockerComposeEnvFileVariable "SQL_SA_PASSWORD" -Value (Get-SitecoreRandomString 19 -DisallowSpecial -EnforceComplexity)
Executing the above command in PowerShell will set the password to SQL_SA_PASSWORD.
TELERIK_ENCRYPTION_KEY
A random string of 64 to 128 characters must be set here. The tool will automatically set this up as well.
Set-DockerComposeEnvFileVariable "TELERIK_ENCRYPTION_KEY" -Value (Get-SitecoreRandomString 128)
Configuration for Identity Server
The following three items must be configured for the Identity Server to log in.
- SITECORE_IDSECRET : Random string of 64 characters
- SITECORE_ID_CERTIFICATE :
- SITECORE_ID_CERTIFICATE_PASSWORD
This can also be configured by executing the same command as above. In this case, we will work with a domain name of localhost, so we will create it as follows
Set-DockerComposeEnvFileVariable "SITECORE_IDSECRET" -Value (Get-SitecoreRandomString 64 -DisallowSpecial)
$idCertPassword = Get-SitecoreRandomString 8 -DisallowSpecial
Set-DockerComposeEnvFileVariable "SITECORE_ID_CERTIFICATE" -Value (Get-SitecoreCertificateAsBase64String -DnsName "localhost" -Password (ConvertTo-SecureString -String $idCertPassword -Force -AsPlainText))
Set-DockerComposeEnvFileVariable "SITECORE_ID_CERTIFICATE_PASSWORD" -Value $idCertPassword
Having proceeded this far, the only item remaining is the license.
![envfile.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F3KRcws2JW1ca8tAruqInw9%2Fd72842e83dd32f8942ed74f978093860%2Fenvfile.png&w=3840&q=75)
SITECORE_LICENSE
The license file is used to define this environment variable. This can also be easily configured by using the tool.
Set-DockerComposeEnvFileVariable "SITECORE_LICENSE" -Value (ConvertTo-CompressedBase64String -Path "C:\projects\license.xml")
Host name
This time, the host name is XP0, so the configuration is simple: one CM and one Identity Server. This time, we will proceed with this name as originally described.
CM_HOST=xp0cm.localhost
ID_HOST=xp0id.localhost
Note that the above host must be locally identifiable, so it must be written on localhost. The process is completed by executing the following two lines in PowerShell.
Add-HostsEntry "xp0cm.localhost"
Add-HostsEntry "xp0id.localhost"
The preparation is complete in the form that all have been executed and the parameters have been filled in.
![dockertoollog.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F5ycMBNazlriT1yQWIOuzxf%2F37477d07fc67a0599c97cfee8144d6d7%2Fdockertoollog.png&w=3840&q=75)
Certificate Preparation
Since https communication is the standard for Sitecore, a certificate must be prepared. In this case, we are working with a domain name of localhost, so we will create a self-certificate.
First, download mkcert.ext as a tool to create certificates
- Access to https://github.com/FiloSottile/mkcert/releases/
- Download the Windows tool (in this case mkcert-v1.4.3-windows-amd64.exe )
- Rename the file to mkcert.exe and copy it to C:\projects\compose\ltsc2019\xp0\traefik
- Open the properties of mkcert.exe, check the security items listed at the bottom of the dialog and allow them to be used
![mkcert.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F4auscxDznirFtNV9jtY6d4%2F0e18ea4a79192091747662929f5eda85%2Fmkcert.png&w=1920&q=75)
- Run mkcert -install and click Yes on the dialog
![mkcert2.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2FPDBUYln0SV3aDkM0rV8Mb%2Fdeb4932f8394e933b56f9ff7dd6d78d1%2Fmkcert2.png&w=1920&q=75)
You are now ready to go. Now we will use this tool to create the client authentication and key files needed to set up the certificate.
.\mkcert -cert-file certs\xp0cm.localhost.crt -key-file certs\xp0cm.localhost.key "xp0cm.localhost"
.\mkcert -cert-file certs\xp0id.localhost.crt -key-file certs\xp0id.localhost.key "xp0id.localhost"
After completing the above steps, the required files are created under certs.
![certs.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F6Ic9672fHtStK7roByH8nZ%2F46037c5bcf7378fe9615f95f093a5a5f%2Fcerts.png&w=2048&q=75)
In the folder C:\projects\compose\ltsc2019\xp0\traefik\config\dynamic, a file certs_config.yaml is prepared.
tls:
certificates:
- certFile: C:\etc\traefik\certs\xp0cm.localhost.crt
keyFile: C:\etc\traefik\certs\xp0cm.localhost.key
- certFile: C:\etc\traefik\certs\xp0id.localhost.crt
keyFile: C:\etc\traefik\certs\xp0id.localhost.key
Since the file name is the same as the file name of the certificate file we are creating, we will proceed as is.
Launch Sitecore using containers
C:\projects\compose\ltsc2019\xp0\ のフォルダに移動をして、以下のコマンドを実行してください。
docker-compose up -d
The image will begin downloading according to the definitions in the docker-compose.yml file. The first time, this download and deployment will take some time. After the download is complete, the container is deployed according to the definition.
![dockercompose.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F2zm9vdcNImrJImZCLo5nfW%2Fba26c8fda75569edbf4011b347457166%2Fdockercompose.png&w=3840&q=75)
VSCode Docker Extensions
It will take a while to install the Docker extension available in Visual Studio Code, search for Docker in Visual Studio Code extensions and the tool will appear.
![vsdocker.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F7uCD3tioLNYOY99Lx3Q4zA%2Fd92829fa220532c0f7a0f14b9ecae438%2Fvsdocker.png&w=3840&q=75)
After the installation is complete, a Docker icon will appear on the left side. Clicking this icon will allow you to browse and manipulate images and containers.
![vsdocker2.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2FkgH3MFtRRZnLVtLNup4TL%2Fe7fcc4721af7fa64df8b7fa334acca4d%2Fvsdocker2.png&w=3840&q=75)
Access test
When the docker-compose process is actually finished, the following screen is displayed.
![dockercompose2.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2FXBO7lP4xnAIUvolBTxOs3%2F1eab52727576c28693ebcf0f33ff1fc6%2Fdockercompose2.png&w=3840&q=75)
Browse to the Docker extension in Visual Studio Code and you will see the following screen
![vsdocker3.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F10pyQpCNpWizeFE1x3a0e1%2F869aac3bd96290207ffa5bae50f422fc%2Fvsdocker3.png&w=3840&q=75)
To access the actual server you are running on, access the following URL in your browser
- https://xp0cm.localhost
The Sitecore Welcome page will appear as shown below.
![welcome.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F18TB4t4sdsqg5LfuCleB8M%2F6f651b359bed363b70e85d517c6dbaa0%2Fwelcome.png&w=3840&q=75)
Add /sitecore to the URL to go to the login screen, where the Admin password is the password defined in .env. After successful login, the administration screen will appear.
![launchpad.png](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fzi1ovlormku8%2F40lj5V59ACUCkq4MsVx3cb%2Fad2bef7d4abdbef5d5924a3f0879e614%2Flaunchpad.png&w=3840&q=75)
Check Folders
We will now check how it actually works. First, data related to SQL Server and indexes are deployed in the following folders, respectively
- C:\projects\compose\ltsc2019\xp0\mssql-data
- C:\projects\compose\ltsc2019\xp0\solr-data
In other words, data is retained even when container use is stopped or terminated.
Tip: Since the SQL Server password is defined in .env, if the password is changed, the container must be stopped and closed, then deleted and deployed again.Stop, end
To stop the container, use the following command
docker-compose stop
In this case, the container is just stopped. If you actually want the container to be deleted,
docker-compose down
The container will be deleted by running docker-compose up -d. Running docker-compose up -d again will create the same container as the initial startup.