Debugging Containers In Sitecore Docker

Sitecore Docker Pro Tips Series

March 4, 2022

You can attach a shell to a container to diagnose folder structures and files deployed.

      docker container exec -it <container-name/id> powershell

    

You can also use this within the context of the docker compose to analyze failed containers ,i.e. to check network connectivity to the database service (mssql) using ping or telnet.

Screenshot of debugging containers in Sitecore Docker

You can also spin up images independently in a similar way to examine the contents (Run Interactive in VSCode using the docker extension).

So you may ask, what does this have to do with Sitecore?

The answer is simply that, with increasing adoption of Sitecore on Docker, there is a need for understanding more of how docker is used in the Sitecore ecosystem. As it pertains to this tip, many developers often wonder how they would layer in various modules and how to do build files. Knowing the filesystem in a module's image, by spinning it up and browsing, gives insight in what is required for a custom build file for example.

      COPY --from=sxa \module\tools \module\tools

    

Tells the developer that there is a directory called modules\tools in the "sxa" image, which has important contents to be copied when doing a custom build of the CM container.

In upcoming tips, I will explore more the concept of layering modules in a build file.

Cheers.