Setup Publishing Service Module for Dockerized Sitecore
Today, in this article, I will showcase how you can set up the Publishing Service Module for the Dockerized Sitecore.
Here in this article, I’ll present step by step setup of the publishing service module inside the dockerized Sitecore.
Let’s get started!!!!
I am using the Boilerplate code repository below for this tutorial, provided for the Sitecore Hackathon competition. You will find all the necessary instructions for starting the dockerized Sitecore using this boilerplate code in the readme file. So, I am not repeating those steps in this article to focus on this article’s topic.
https://github.com/Sitecore-Hackathon/Boilerplate
Clone the Boilerplate code repository on your local system.
For this article purpose, I cloned the repository on my local folder named ‘sc-on-docker’ as shown in the following image.

Before moving ahead, please set up and start the dockerized Sitecore from the boilerplate code repository. For this article purpose I setup with XP0 + SXA topology.
According to the Sitecore Publishing Service Container Deployment Guide, we have to prepare custom images for CM, CD, and MSSQL. These images must include the resources, files, databases, and so on from the Sitecore Publishing Service asset image.
Sitecore has provided the following asset images for the publishing service:
- sxp/modules/sitecore-sps-integration-xm1-assets
- sxp/modules/sitecore-sps-integration-xp1-assets
I have used the ‘sxp/modules/sitecore-sps-integration-xp1-assets‘ image to build my CM and MSSQL images for this article purpose.
Now, open the code directory in the Visual Studio Code, and open the docker-compose.override.yml file.

In the docker-compose.override.yml file, look for the ‘mssql’ service and add the SPS_ASSETS in the args section as shown in the following code block.
mssql:
image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xp0-mssql:${VERSION:-latest}
build:
context: ./build/mssql
args:
PARENT_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-mssql:${SITECORE_VERSION}
SPE_IMAGE: ${SITECORE_DOCKER_REGISTRY}modules/spe-assets:${SPE_VERSION}
SXA_IMAGE: ${SITECORE_DOCKER_REGISTRY}modules/sxa-xp1-assets:${SXA_VERSION}
SPS_ASSETS: scr.sitecore.com/sxp/modules/sitecore-sps-integration-xp1-assets:10.1-1809
volumes:
- ${LOCAL_DATA_PATH}\mssql:c:\data
mem_limit: ${MEM_LIMIT_SQL:-2GB}
restart: always
Now open the Dockerfile from the docker/build/mssql folder.

Modify the Dockerfile similar to the following block code. The bold text represents the change.
# escape=`
ARG PARENT_IMAGE
ARG SXA_IMAGE
ARG SPE_IMAGE
ARG SPS_ASSETS
FROM ${SPE_IMAGE} as spe
FROM ${SXA_IMAGE} as sxa
FROM ${SPS_ASSETS} as sps
FROM ${PARENT_IMAGE}
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Add SPE module
COPY --from=spe \module\db \spe_data
RUN C:\DeployDatabases.ps1 -ResourcesDirectory C:\spe_data; `
Remove-Item -Path C:\spe_data -Recurse -Force;
# Add SXA module
COPY --from=sxa \module\db \sxa_data
RUN C:\DeployDatabases.ps1 -ResourcesDirectory C:\sxa_data; `
Remove-Item -Path C:\sxa_data -Recurse -Force;
# Add SPS module
COPY --from=sps \module\db \sps_data
RUN C:\DeployDatabases.ps1 -ResourcesDirectory C:\sps_data; `
Remove-Item -Path C:\sps_data -Recurse -Force;
Again, open the docker-compose.override.yml file and modify the cm service section as mentioned in the following code block.
cm:
image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xp0-cm:${VERSION:-latest}
build:
context: ./build/cm
args:
PARENT_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-cm:${SITECORE_VERSION}
SOLUTION_IMAGE: ${REGISTRY}${COMPOSE_PROJECT_NAME}-solution:${VERSION:-latest}
SPE_IMAGE: ${SITECORE_DOCKER_REGISTRY}modules/spe-assets:${SPE_VERSION}
SXA_IMAGE: ${SITECORE_DOCKER_REGISTRY}modules/sxa-xp1-assets:${SXA_VERSION}
TOOLS_IMAGE: ${TOOLS_IMAGE}
SPS_ASSETS: scr.sitecore.com/sxp/modules/sitecore-sps-integration-xp1-assets:10.1-1809
depends_on:
- solution
volumes:
- ${LOCAL_DEPLOY_PATH}\platform:C:\deploy
- ${LOCAL_DATA_PATH}\cm:C:\inetpub\wwwroot\App_Data\logs
- ${HOST_LICENSE_FOLDER}:c:\license
environment:
SITECORE_LICENSE_LOCATION: c:\license\license.xml
Sitecore_Publishing_Service_Url: "http://sps/"
entrypoint: powershell -Command "& C:\tools\entrypoints\iis\Development.ps1"
mem_limit: ${MEM_LIMIT_CM:-4GB}
restart: always
labels:
- "traefik.http.middlewares.redirect-to-https.redirectScheme.scheme=https"
- "traefik.http.routers.cm.entrypoints=web"
- "traefik.http.routers.cm.rule=Host(`${CM_HOST}`)"
- "traefik.http.routers.cm.middlewares=redirect-to-https"
Now open the Dockerfile from the docker/build/cm folder.

Modify the Dockerfile as shown in the following block code.
# escape=`
ARG PARENT_IMAGE
ARG SOLUTION_IMAGE
ARG SXA_IMAGE
ARG SPE_IMAGE
ARG TOOLS_IMAGE
ARG SPS_ASSETS
FROM ${SOLUTION_IMAGE} as solution
FROM ${TOOLS_IMAGE} as tools
FROM ${SPE_IMAGE} as spe
FROM ${SXA_IMAGE} as sxa
FROM ${SPS_ASSETS} as sps
FROM ${PARENT_IMAGE}
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Copy development tools and entrypoint
COPY --from=tools \tools\ \tools\
WORKDIR C:\inetpub\wwwroot
# Add SPE module
COPY --from=spe \module\cm\content .\
RUN Rename-Item -Path "c:\inetpub\wwwroot\App_Config\Include\Spe\Spe.IdentityServer.config.disabled" -NewName "Spe.IdentityServer.config"
# Add SXA module
COPY --from=sxa \module\cm\content .\
COPY --from=sxa \module\tools \module\tools
RUN C:\module\tools\Initialize-Content.ps1 -TargetPath .\; `
Remove-Item -Path C:\module -Recurse -Force;
# Add SPS module
COPY --from=sps \module\cm\content .\
# Copy solution website files
COPY --from=solution /artifacts/platform/ ./
Now open the docker-compose.override.yml file and add the following sections. You can add these two sections anywhere in the file, making sure the file format is maintained per Docker Compose requirements.
sps-mssql-init:
isolation: ${ISOLATION}
image: scr.sitecore.com/sxp/modules/sitecore-sps:5.0-ltsc2019
environment:
SITECORE_Sitecore:Publishing:ConnectionStrings:Core: Data Source=mssql;Initial Catalog=Sitecore.Core;User ID=sa;Password=${SQL_SA_PASSWORD};MultipleActiveResultSets=True
SITECORE_Sitecore:Publishing:ConnectionStrings:Master: Data Source=mssql;Initial Catalog=Sitecore.Master;User ID=sa;Password=${SQL_SA_PASSWORD};MultipleActiveResultSets=True
SITECORE_Sitecore:Publishing:ConnectionStrings:Web: Data Source=mssql;Initial Catalog=Sitecore.Web;User ID=sa;Password=${SQL_SA_PASSWORD};MultipleActiveResultSets=True
command: schema upgrade --force
depends_on:
mssql:
condition: service_healthy
sps:
isolation: ${ISOLATION}
image: scr.sitecore.com/sxp/modules/sitecore-sps:5.0-ltsc2019
environment:
ASPNETCORE_URLS: "http://*:80"
SITECORE_Sitecore:Publishing:ConnectionStrings:Core: Data Source=mssql;Initial Catalog=Sitecore.Core;User ID=sa;Password=${SQL_SA_PASSWORD};MultipleActiveResultSets=True
SITECORE_Sitecore:Publishing:ConnectionStrings:Master: Data Source=mssql;Initial Catalog=Sitecore.Master;User ID=sa;Password=${SQL_SA_PASSWORD};MultipleActiveResultSets=True
SITECORE_Sitecore:Publishing:ConnectionStrings:Web: Data Source=mssql;Initial Catalog=Sitecore.Web;User ID=sa;Password=${SQL_SA_PASSWORD};MultipleActiveResultSets=True
ports:
- "80"
depends_on:
- sps-mssql-init
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/healthz/live"]
timeout: 300s
Now start the environment using the ‘start-hackathon.ps1’ script.
Check if you see the publishing service dialog is available or not by publishing any of the items. If you can see the following dialog and publish the item successfully, your integration of the publishing service with dockerized Sitecore is done!!!

If you see the following error, then perform the steps mentioned ahead to fix the issue.
You get this error if you run the dockerized Sitecore earlier, where all the databases are initialized. Once the databases are initialized in the volumes folder, the new schema changes are not getting applied.

- Stop the dockerized Sitecore.
- Open the docker/data/mssql folder in file explorer and delete all the database files.
- Start the dockerized Sitecore.
Please find the complete code at Github.
Happy dockerized Sitecore…!!!