This time, we'll set up a Docker environment on a virtual machine deployed on Microsoft Azure. While using Docker for Desktop on Windows 10 Pro is the simplest method, we'll focus on configuring the environment on Windows Server 2019.
Prerequisite.
The prerequisites for working on this project are as follows: Since the environment is set up in Azure, we prepared the following machines.
- Windows Server 2019
- Virtual Machine size Standard D8s v3
- 8 vcpu
- memory 32GB
After the machine has been created, access it via remote desktop: start Server Manager, select Manage - Add Roles and Features from the menu, and add the following features
First, check Hyper-V on the Server Roles screen.
Then, in the Features screen, select Containers and Windows Subsystem for Linux.
The installation will proceed with the default settings for Hyper-V. Finally, press the Install button to complete the installation. Once the installation is complete, the system will reboot and be ready to go as far as the Windows Server 2019 environment is concerned.
Setting up a Docker environment
For instructions on running Docker on Windows Server, please refer to the following site from Microsoft.
Open PowerShell with administrator privileges and install the Docker-Microsoft PackageManagement Provider from the PowerShell gallery.
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install the latest version of Docker using the PackageManagement PowerShell module.
Install-Package -Name docker -ProviderName DockerMsftProvider
Since the Sitecore demo also uses a Linux image, we will install LinuxKit. First, download release.zip from the following site
Note: This Linux Container on Windows using LinuxKit is no longer supported. It is left here for your reference as it was back then, but it is not available now.The downloaded file should be created and extracted to a folder C:\Program Files\Linux Containers The copied file is blocked after downloading, so unblock it by opening the file properties and applying it by checking the checkbox at the bottom of the dialog.
To run a Windows container and a Linux container at the same time, change the Experimental configuration. To do this, create a new file C:\ProgramData\docker\config\daemon.json and write the following code. Please display it by putting the path directly into Explorer, etc.
{
"experimental": true
}
Reboot once the installation of the required Docker modules is complete.
Additional Software Installation
We will be using a tool called chocolatey to install the software we will be using.
The installation process is simple: open the PowerShell console with administrative privileges and execute the following command
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
If the version is displayed when choco is run on the command line, the installation was successful.
To use the Github repository, first install git for Windows.
choco install git
To enable docker-compose, the command to use Dokcer, run the following command
choco install docker-compose
Next, install Visual Studio Code, as it is useful for making changes to the code.
choco install vscode
Install Google Chrome so that you can run the browser.
choco install googlechrome
It is convenient to have Github Desktop installed, so please use this optionally (it is not specifically required as part of this procedure).
choco install github-desktop
Summary
This time, we have even set up a Docker environment running on Windows Server 2019. Now we can easily test the demo provided by Sitecore.