Sitecore 10 installation on Docker & troubleshooting
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.
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
Download and install Docker for desktop from here - https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe.
Make sure Virtualization is enabled on the machine. This can be verified in the Task Manager.
Enable Hyper-V by running the following command from a Powershell command prompt.
Enable-WindowsOptionalFeature -Online -FeatureName $("Microsoft-Hyper-V", "Containers") -all
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.
Install Sitecore 10 on Docker desktop
Download/Clone the following Git repository to your local - https://github.com/Sitecore/docker-examples. Unzip the folder to some location on your machine.
Go to the folder where you have unzipped the folder, say D drive. Accordingly open Powershell in the path 'docker-examples-develop\getting-started'.
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
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
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!