Advanced Troubleshooting Sitecore Docker Containers

Anton Tishchenko
Anton Tishchenko
Cover Image for Advanced Troubleshooting Sitecore Docker Containers

Troubleshooting Sitecore Docker containers is hard. The more you work with Docker the better you get used to it. But it is still hard. Well, it is harder than troubleshooting locally. You need to know some technics to troubleshoot efficiently. This article will explain one of them: viewing Windows event log from the Sitecore Docker container.

I will show the example of usage on an obvious error: wrong config file on CM container. But this technic is more useful for troubleshooting low-level problems: IIS doesn’t start, MS SQL doesn’t attach some databases, etc.

When you don’t use Traefik, for a major part of problems you will get enough information from the error message that is displayed in the browser:

Error

With Traefik enabled, you will get just a blank screen with no error. You can review Sitecore logs, but that does not always give results. I faced low-level issues when there were no Sitecore logs. Or logs like this, with no useful info:

2104 17:19:06 INFO  **************************************************
2104 17:19:06 WARN  Sitecore shutting down
2104 17:19:06 WARN  Shutdown message: Initialization Error
HostingEnvironment initiated shutdown

You can also connect try to run curl directly on your container:

# open cmd on your container
docker exec -it {CM container ID} cmd
# make request to local server
curl localhost

That may give you a clue. But again, not always. You may get nothing. What next? On your local desktop, you will go to Widows event logs. But you get the issue in the container. Here we go to the main part.

Get a Windows Event Log from Sitecore Docker Container

There is wevtutil in Windows. It allows you to do different operations with the event log. We are interested in exporting the event log to a separate file.

# open cmd on your container
docker exec -it {CM container ID} cmd
# navigate to the folder where your logs are saved. it can be any mapped Docker volume as we want to get file locally on your desktop.
cd C:\inetpub\wwwroot\App_Data\logs
# export logs
wevtutil epl Application 20220603.evtx

Our log file 20220603.evtx will be placed into our Sitecore logs folder. And we will be able to open it by double click:

Windows Event Log

Now you are able to review all events and find the root cause of the problem.

Cause

Thanks for reading. Hope this information will save you time if you get Sitecore Docker container issues in the future.