How do I set up a multi-site using Sitecore + Docker?

Karega Anglin - Senior Sitecore Developer

25 Feb 2021

Share on social media

In this blog we will be looking at start to finish of setting up a Multi-site instance of Sitecore using Docker.

Most companies host multiple domains for their business (e.g.,, … etc.), and this happens over time as the company grows and requirements change. It is common to host multiple websites on a single instance of Sitecore, whether that is a subdomain or a completely different domain such as when hosting separate websites for different product brands. These businesses know they will need and know the logistics surrounding it. I would like to demo for the latter companies, how to setup a multi-site instance of Sitecore on Docker using SXA.


  • Sitecore 9.x or 10.x, with SXA +Traefik Docker image
  • Docker containers experience
  • Powershell chops

Planning your domains in docker     

To start adding the domains, we utilize the facility of the docker .env file, to setup our domains as environment variables.

Here we added CM_DOMAINS to the .env file. Note: that the CM_HOST is, and this could be any host name that your instance lives under. However the domain * is used for the sub-domains in CM_DOMAINS. Again, the domains could be whatever you plan for, e.g. or

Multiple SSL certs

Next we need to let mkcert tool generate a cert for multiple domains instead of a single domain. To accomplish this we simply modify the PowerShell script, encapsulating the mkcert tool and send in multiple command-line parameters for the certificate generation (documented here)

This will generate a certificate for the Sitecore instance using the main in *.$(FullHostName) and * as domains.

Binding to Traefik

Next up, we added the domains to Traefik for routing. We added the domains to the docker-compose.override.yml file to extend the main compose file ( ).

Sitecore interacts with Traefik using docker container labels ( ). This will then add another route into Traefik, to let it know how to handle requests coming to the domains. The route "cm-alternate" labeling was used for a cleaner representation in the docker compose file, so debugging issues is easier. We can check our final merged compose file using the "docker-compose config" command to see how everything comes together.

Testing things out

Finally we can now test our domains. Save all and do a "docker-compose up" for the main Sitecore instance, then navigate to the sub-domains.

All looks good! The sub-domains are routing back the main instance, which is exactly what we want to see.

Next we can start building out our sub-domain sites in SXA.

Creating a Tenant in Sitecore SXA

Create a Tenant in the Sitecore Instance and configure appropriately. Once created we can now configure our sub-domain.

  1. Go into Content Editor and click the Sitecore icon menu and select PowerShell Toolbox.

2. This will open up the PowerShell Extension Menu, and we select the SXA Site Manager.

3. We select the edit the SXA Tenant site and add the sub-domain into the "Host Name" field, save and publish.

Test it out!!

Now that we configured the SXA Site, lets navigate to the domain as before.

Here we demonstrated how to configure and spin up a multi-site instance of Sitecore with SXA on Docker. This adds an easy way of spinning up a well mapped out sub-domain hierarchy on a single instance and get you up and running in no time with no changes to the Sitecore configuration files needed.

Sign up to our newsletter

Share on social media

Karega Anglin

With over 7 years experience specializing in the Sitecore CMS platform, and more than 10 years in Applications Development, Karega has helped to implement and maintain several high-profile organization websites such as Toronto Transit Commission, Sick Kids Foundation and Ontario College of Teachers. He holds a MSc in Computer Science from the University of the West Indies Jamaica and certifications in both Sitecore CMS .NET and Machine Learning (Coursera).

When not creating software, Karega engages in ministry at his local church and social programs in his community. He is also plays the Bass and Electric Guitar and is inspired by musical the genres such as Gospel, Jazz, Retro/Funk and Latin.

Karega can often be found learning the next new thing in Software development and Artificial Intelligence and believes strongly in always keeping tabs on emerging Tech for the benefit of Society.

Subscribe to newsletter