Docker and Sitecore Publishing Service

Running the Sitecore Publishing Service in Docker

In a recent implementation, I was tasked with implementing the Sitecore Publishing Service for an existing Docker based infrastructure. Part of implementing SPS involved configuring a Preview database publishing target.

The installation guide for SPS includes details on how to configure an additional publishing target, but I found some gaps in the information as I worked through getting things setup. Specifically, there are two issues I discovered:

  1. The details on the configuration for the publishing target are incorrect; there is some configuration missing.
  2. The details on how to specify the connection string for an additional database via an environment variable are not intuitive.

Let’s start with the configuration details for an additional publishing target. Below is the full configuration file that one should use when registering an additional publishing target in SPS.


You can see the gist here:

Most of this configuration comes from the recommended configuration in the documentation. There are two exceptions:

  1. Lines 23-30 (green highlight) – it is necessary to configure a resources node for the items in your additional database
  2. Lines 40-44 (yellow highlight) – the documentation says you only need to specify the connection string in the format of <ConnectionName>Preview</ConnectionName>.  This is not enough to make SPS aware of the connections for the target. Instead, you must specify both the name of the connection and the resources the connection relies on.

One thing you might notice is missing from the above configuration is the actual connection string for the new database. Per the documentation, you can define an additional connection string using the following configuration:

<?xml version="1.0" encoding="UTF-8"?>





        <Preview>Data Source=.;Initial Catalog=Preview;Integrated Security=True;MultipleActiveResultSets=True;ConnectRetryCount=15;ConnectRetryInterval=1</Preview>





You can use this to configure the connection string but adding the connection string via a file will prevent you from overriding the value with an environment variable. IMPORTANT NOTE: This is the opposite of the typical behaviors on the Sitecore platform.

If you want to be able to specify the connection string using an environment variable, then you CANNOT put the connection string in a config file on the instance. Instead of configuring the connection string in a file, you can just add an environment variable to your docker-compose file: SITECORE_Sitecore:Publishing:ConnectionStrings:Preview.

I have put a full example of a Sitecore XP0 build with SPS out on GitHub here: This configuration includes the associated builds that would be necessary to add and configure a preview database for your environment.

Happy coding!