Docker: Have The Right Tag and Debug Containers Easily

Cet article en francais

With the release of Sitecore XP 10 this summer, Docker is now a very good environment to develop and test sitecore projects. There are a lot of documentation around, but I was at time a little bit unsecure about how to debug a docker container while it builds. Hitting the right tag for my images was also not trivial.

In this article I will show you a way to debug the containers when it is in the creation process, and we’ll talk about how to choose the correct tag for the docker base images.

Debug Dockers Containers

When an image builds with the command “docker-compose build” or “docker build”, each step of the Dockerfile is run in a container. The first step’s container is created from the image specified in the Dockerfile’s row beginning by “FROM”. At the end of each step, the container is commited to a new image and next step uses this latest image.

In this example, we can see that the first container comes from the image in BUILD_IMAGE and creates a temporary image with the name aacfb83b6569.

The next step (4/16) is resolving the argument BUILD_CONFIGURATION. This is run in the intermediate container e91c4f2f052d, which is remove directly after and a new image 06bdcf447558 is created, and so on…

Build support caching, so if a step has already run in the past, this step will be passed and the resulting image will be taken from the cache.

Imagine now that for some reason, the build sequence gets an error. As the build is done inside temporary containers, we would want to be able to peek inside this container in order to run the same command and maybe get more information about the error. This is actually quite simple.

Let’s imagine your build has failed as the one in the next image.

The last step (Step 10/15) was run inside a temporary container with the name 74e55016dd17(“—–> Running in 74e55016dd17”).

You want first to commit this temporary container to a runnable image. You have to execute the command:

docker commit 74e55016dd17 myimagename

Then you will run this image to get a new container to debug with. The last parameter is which program you want to use, for example powershell or sh. In the Step 5/15, we can see that this Dockerfile uses Powershell, so I will also open a powershell in this container.

docker run -ti --rm myimagename powershell

The container opens in a powershell console, giving you the opportunity to reproduce the step that made an error and get more information. Of course, you can browse the files or check the environment variables inside the container. Here I can see that I have no source files under \build\src.

Get The Right Tag

As you may have seen in the .env file, all the images we download from our sources have a tag associates. For ex:

That means that we are going to get the image associated this the tag “1809”.

These image names and tags can be configurated both in docker-compose.yml and .env file. Take the CD image definition in the Helix-basic-aspnetcore project.

In the docker-compose.yml, in the definition of the cd service, we have the line:


and in the .env:

Combining those two informations, we get that the image base for cd will be

Here we have therefore the tag “10.0.0-ltsc2019” for the xm1 topology.

This particular tag is composed by the version of the sitecore version (“10.0.0”) and the windows build (ltsc2019), also known as “TargetOS”.

You can find the build of your own windows version by running the following command in Powershell

(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseId

You’ll get a integer value (1803, 1809, 1903, 1909, 2004, 2009) corresponding to your Windows version. 1809 is also known as “ltsc2019” and 2009 is also known as “20H2”.

To see which tag is possible for a specific image, you’ll need to check in the description of this image. Here are the most intresting images you’ll need for a Sitecore installation in Docker:

Sitecore Tags

Traefik Tags

Microsoft Windows Servercore

Microsoft Windows Nanoserver

Happy tagging !

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: