Sitecore 10 installation on Docker & troubleshooting

Pranay
Feb 12, 2022  ยท  462 views

Here is how you can setup Docker for desktop on your Windows machine and install Sitecore 10 containers on it easily as a beginner

With containers development becoming famous in software development, starting from version 10 Sitecore has also provided complete support for containers. We can now run Sitecore on containers for local development and also for production environment going forward. It also allows to use container orchestration tools like Kubernetes to run the containers in production on a scale.

Running Sitecore on containers

Prerequisites

Here is the list of prerequites from Sitecore to run Sitecore instances on Docker - Sitecore 10 on Docker desktop prerequisites

Note: The default Sitecore container configuration uses specific ports. To avoid any conflicts, ensure that the following ports are not being used by another process: 443, 8079, 8081, 8984, and 14330.

Install Docker for desktop

  1. Download and install Docker for desktop from here - https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe.

  2. Make sure Virtualization is enabled on the machine. This can be verified in the Task Manager.

    Enable Virtualization

  3. Enable Hyper-V by running the following command from a Powershell command prompt.

     Enable-WindowsOptionalFeature -Online -FeatureName $("Microsoft-Hyper-V", "Containers") -all
    
  4. Switch Docker to run on Windows Containers. If it is already running on Windows containers then you should see 'Switch to Linux containers' option. FYI, Sitecore needs Windows containers and cannot run on Linux containers.

    Switch to Windows containers

Install Sitecore 10 on Docker desktop

  1. Download/Clone the following Git repository to your local - https://github.com/Sitecore/docker-examples. Unzip the folder to some location on your machine.

  2. Go to the folder where you have unzipped the folder, say D drive. Accordingly open Powershell in the path 'docker-examples-develop\getting-started'.

  3. Run the following Powershell command.

     .\init.ps1 -LicenseXmlPath D:\License\license.xml
    

    Note: Replace 'D:\License\license.xml' with the path to the license file in your machine.

    • This command will populate '.env' file located in the folder 'docker-examples-develop\getting-started'.
    • It also adds localhost site entries in the host file

    init.ps1

  4. Run the following command to download and setup the docker containers as mentioned in the docker-compose.yml file. It would take some time to download and spin up the containers.

     docker-compose up -d
    

    docker-compose up

  5. Once the command successfully completed, you should be able to open the site by browsing the CM URL https://xp0cm.localhost. If this is not the case, then try the following commands one after the other in PowerShell.

     docker-compose stop
    
    
     docker-compose down
    
    
     iisreset /stop
    
    
     docker-compose up -d
    

If this also did not solve the issue, please go through the troubleshooting steps on unhealthy Sitecore docker containers here - Resolving unhealthy Sitecore container issues

Troubleshooting issues

If you see an error while bring up the site on containers there could be multiple reasons for that.

Here is a list of troubleshooting techniques for the same - Troubleshooting unhealthy Sitecore containers on Docker . Hope one of these should resolve your issue.

If none of them works, try restarting the Docker for desktop or restart the machine. Might look illogical but sometimes it will work. Hope this helps you, please comment your thoughts!

AUTHOR

Pranay

A Software Engineer by profession, a part time blogger and an enthusiast programmer. You can find more about me here.


Post a comment




Thank you! You are now subscribed.

Sign up for our newsletter

Subscribe to receive updates on our latest posts.

Thank you! You are now subscribed.