I'm creating a CI/CD pipeline, and I'd want to understand how am I going to use the same docker image (assuming it is possible) and deploy it to multiple AKS environments such as QA, STG, and Prod.

Additionally, how am I supposed to perform the transformation in my code if the idea is to create a single image and deploy it to a different environment?

2 Answers 2


If you think about the base Sitecore images distributed from the Sitecore container registry, these images deliver immutable code that can be deployed on any AKS cluster. The reason this is possible is because all unique configuration variables are managed via environment variables in the images and managed as Kubernetes secrets in AKS.

If you want your custom images containing your custom code to be deployed on different AKS clusters representing different environments (QA, UAT, regression,...), you need to handle custom settings in your solution that might have different values among your environments using environment variables as well.

For the transformations, you can still use them to apply changes to config files that cannot be patched (ie. web.config) when you build your solution asset image, but you cannot use different transformations for different environments. Instead you can use custom config roles (with custom app settings) to define rule-based configurations that apply to a specific environment only (see documentation). The value of the custom app setting that defines your environment would of course still be managed with an environment variable.

  • hey ive just come across your answer. Is it possible to use environment variables for app settings. I was under the impression that this wasnt possible. Do you have a guide at all? Commented Sep 6, 2022 at 15:31
  • @RichardBanks This is possible thanks to the SitecoreAppSettingsBuilder config builder that has been added to the appSettings configuration element in the Sitecore web.config since SC 9.3. This builder has the following settings: mode="Strict" prefix="SITECORE_APPSETTINGS_". Strict mode requires the app setting to be defined in the web.config file in order for a matching environment variable to be read. This is an example of usage from the Sitecore Docker Examples repo: github.com/Sitecore/docker-examples/blob/develop/custom-images/… Commented Sep 6, 2022 at 16:48

You might want to give a try and use Init Images, as described by George Chang at this article: https://georgechang.io/posts/2021/installing-sitecore-packages-to-containers/

Init images are special images that run once to do some initialization on the containers once they load. These typically are to handle exceptions for things that can’t be baked into images (or don’t make sense to be baked in). The two that ship with Sitecore are to create the Solr indexes and SQL databases - makes sense in case you’re using a hosted service for either so you’ve got options.

So, if you’re adding/updating files to your runtime images - easy. You’ve got your various files and DLLs to copy in. Hold on to those.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.