Create custom docker images and containers using Sitecore version 10.1

This post will describe how to create your custom Docker images and containers using the Sitecore 10.1 version.

Pre-requisites:

To run Docker on Windows 10, you need the following:

  • You must run Windows 10 Professional or Enterprise version 1903 or later. For enabling process isolation, you need version 1909, or later.
  • You must enable Hyper-V. The Docker Desktop installer enables Hyper-V if necessary, but a machine restart is then required during install.

Hardware Requirements

  • 16GB of RAM is the minimum, 32GB of RAM is recommended. This depends on the number of instances and topologies you want to run (that is, the number of simultaneously running containers). For example, 16GB may be sufficient for XM1 or XP0 instances, but will probably have problems running a full XP1 instance.
  • A quad-core, or higher, CPU.
  • At least 25GB of free disk space for Sitecore container images. SSD storage is highly recommended for optimal performance when downloading and running Docker containers.

I am using Azure VM Standard D8s v3 (8 vcpus, 32 GiB memory) OS – Windows (Windows 10 Pro)

Network Requirements:

  • Enable Hyper-V on machine

Open windows features and select Hyper-V. Please ensure to select all options of Hyper-V as per the below snapshot and restart the machine.

Once installation is completed, please run docker desktop.

You will see a system tray icon and docker running in Linux containers. Switch it to windows container

Extract it.

  • We need an only a custom-images folder for this article. The folder will look like below.

I am updating the .env file parameters as highlighted below but you can keep it as is if needed.

  • Run Powershell in admin mode and navigate to the path C:\Docker\docker-examples-develop\custom-images

Now run the below command

.\init.ps1 -LicenseXmlPath C:\license\license.xml -SitecoreAdminPassword b -SqlSaPassword Sitecore@123 -HostName customrepo

  • Pull the parent packages by running the below command

docker-compose pull

  • Build the custom images by running the below command. This usually takes a lot of time

docker-compose build

  • Create/Start the containers by running the below command

docker-compose up -d

You will see the customrepo containers and custom images.

Run the application by hitting URL – https://cm.customrepo.localhost

You can rebuild the indexes and are good to go.

Issues:

The Sitecore container environment includes a solr-init container that runs on startup, creates the needed cores in your Solr container (if they do not exist already), and then exits. This is the expected behavior.

However, this container does not populate the Solr managed schemas or rebuild indexes. You need to do this manually or with custom scripting. You can see Solr-related errors in your container logs if you do not do this.

To populate the managed schema and update indexes:

  1. Log in to Sitecore as admin.
  2. Open the Control Panel and populate the managed schema for all search indexes.
  3. While still in the Control Panelrebuild search indexes.

Thanks, Sitecore!!

References:

https://github.com/Sitecore/docker-examples

Comments