Troubleshooting unhealthy Sitecore containers on Docker
The Sitecore containers on Docker might go down for many reasons. Here is a list of some probable reasons why they might go down and also some troubleshoot techniques through which you can find the root cause behind the unhealthy containers.
Make sure your docker is running on Windows containers. To check this, right click on the Docker icon in the system tray and check if you are seeing 'Switch to Linux containers' option. If yes, then the Docker is already running for Windows containers .
Make sure 'Use Docker Compose V2' is unchecked.
Run the following commands and see if that works
docker-compose stop docker-compose down iisreset /stop docker-compose up -d
404 page not found error: If you are seeing this error when browsing the CM/CD site then this might be the cause. Connect to the containers either from Visual Studio or from Visual Studio Code and run the following command to browse the site from inside the containers. This will show the actual error on the site and accordingly it can be resolved.
curl http://localhost/
Error due to the docker-compose is running on v2 version. Run this command to check the same
If it is running in v2, then uncheck 'Use Docker Compose V2' in Docker -> settings. Sometimes you might see that it shows v2 even though the 'Use Docker Compose V2' is unchecked. In that case disable the V2 using the following command
docker-compose disable-v2
mem_limit error: This error is also caused due the reason that your docker is running on V2. SO make sure it is not running on v2.
ERROR: for xxxxxx Cannot start service xxxxxx: hcsshim: :CreateComputeSystem xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. The requested resource is in use.. You may see this error when trying to bring up the containers as shown below.
The solution is to restart the service "Hyper-V Host Compute Service" and try again.
Stop IIS and also disconnect from any VPN service if you are connected. The docker might not work if your VPN is active.
Check the Sitecore logs and Docker logs.
- Sitecore logs folder path depends on to which path it is mapped.
- Docker logs can be checked by clicking on the running container in Docker desktop.
Run the clean.ps1 script to remove the Solr an SQL Server files and try again.
Will keep this post updated with all the latest troubleshoot issues. Hope this helps.