Several factors could cause Sitecore containers running on Docker to stop functioning or display as unhealthy containers. To troubleshoot or fix the errors, we ran into a few Docker container issues, which we have listed below. This helped us identify and comprehend the root causes of the problems, which allowed us to check and fix the Docker container issue and get our Sitecore instance up and running.
Before moving on to the errors, take the necessary precautions:
- If IIS is operating, make sure to stop it.
- Any Solr services installed on the machine should be stopped.
- Disconnect any VPN services if connected, as Docker might not work if a VPN is connected.
- Investigate the Docker or Sitecore logs to find the root cause of the issue.
Docker Logs: To see docker logs, navigate to the docker desktop dashboard and choose either active or unhealthy containers. (Not working).
Problem 1: Docker Cannot Enable Hyper -V Services
First Solution:
Using the instructions below, we can manually enable the Hyper-V services: –
- Choose the “Apps and Features” options by right-clicking the Windows button.
- Choose the “Programs and Features” option from the Related Settings tab on the right-hand side.
- Now choose “Turn Windows Features on or off” from the left-hand side.
- Choose Hyper-V, then click OK.
- Restart the system.
Second Solution:
By using the PowerShell instructions, we can also enable the Hyper-V services: –
- Right-click on the system’s Windows icon and choose “Windows PowerShell” (Admin Mode).
- Enter the following code once the PowerShell terminal has loaded. Once Windows has finished enabling Hyper-V, restart your computer.
DISM/Online/Enable-Feature/All/FeatureName:Microsoft-Hyper-V
Problem 2: Unlock the Sitecore User Account Using Docker
First Solution:
A Sitecore instance running on Docker didn’t have access to MSSQL directly. In light of this, we choose to replace the Core database MDF & LDF files with the earlier versions. The MDF and LDF files can be directly replaced if we have an earlier Core database backup, or We redownload the files from the docker MSSQL image if we don’t have a backup.
Note: If we replace the MDF and LDF files, we risk losing the most recent CORE database modifications.
In the Docker instance, the MDF & LDF files of the MSSQL database are in the data/mssql folder.
Example: YourProjectFolder/docker/data/mssql/
Second Solution:
An alternative to unlocking sitecore is available in this blog, “How to Reset the Sitecore Admin Password inside a Docker Container,” authored by David San Filippo.
Problem 3: Unable to start Traefik Container
Unable to start Traefik container OR the Traefik container “id” is unhealthy OR cannot begin to service Xconnect: The process cannot access the file as it is being used by another method.
Solution:
This error indicates that Traefik containers are currently in use. The IIS is mostly to blame. Check the IIS and shut it down.
Command to stop IIS from PowerShell: iisreset/STOP
Problem 4: Docker-compose up command cannot be loaded
Init.ps1 or Docker-compose up command cannot be loaded, because running scripts is disabled on this system
Solution:
In this scenario, we need to execute the following script, granting us permission to execute the scripts using PowerShell.
set-executionpolicy remotesigned
We’ll address the remaining Docker issues and their solutions in the subsequent blog post, Troubleshooting Docker Container Problems Part 2.
Hope this was useful. Enjoy your troubleshooting!!