I am using docker approach with Sitecore V10.2. I am trying to create a custom index with it's associated schema.

I followed following article as the reference point : Add your custom index to Solr in Sitecore Docker like a boss(goon)

Although, it seems like the article was written for Sitecore V10.0(Initial Release) docker solution. With V10.2, all the solr initialization steps(scripts) have been moved into the solr-init container also the script names & content is also changed.

I was able to locate one script which seems like can be used to create a custom index.

New-SolrCore.ps1 :







function Invoke-SolrWebRequest {
    param (

    return Invoke-RestMethod -Credential (Get-SolrCredential) -Uri $Uri `
        -ContentType "application/json" -Method Post
foreach($solrCoreName in $SolrCoreNames) {

$solrCollectionName = ('{0}{1}' -f $SolrCorePrefix, $solrCoreName)
Write-Host "Creating $solrCollectionName SOLR collection"

$solrUrl = [System.String]::Concat($SolrEndpoint, "/admin/collections?action=CREATE&name=", $solrCollectionName , 
    "&collection.configName=", $SolrConfigsetName, "&replicationFactor=", $SolrReplicationFactor, 
    "&numShards=", $SolrNumberOfShards, "&maxShardsPerNode=", $SolrMaxShardNumberPerNode, "&property.update.autoCreateFields=false")
$null = Invoke-SolrWebRequest -Uri $solrUrl

if( $SolrCollectionAliases.$solrCoreName ) {
    $aliasName = '{0}{1}' -f $SolrCorePrefix, $SolrCollectionAliases.$solrCoreName
    .\New-SolrAlias.ps1 -SolrEndpoint $SolrEndpoint -SolrCollectionName $solrCollectionName -AliasName $aliasName

So, I made a few changes suggested in the mentioned article to my Dockerfile according to the parameters of New-SolrCore.ps1 script expected parameters.

Following is my DockerFile changes for the custom solr-init image :

DockerFile :

# escape=`



SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

COPY customCores/custom_master_index C:\custom_master_index

RUN C:\New-SolrCore.ps1 -SolrEndpoint C:\data -SolrCoreNames '_custom_master_index' -SolrCorePrefix 'sitecore' -SolrConfigsetName C:\custom_master_index\managed-schema -SolrReplicationFactor '1' -SolrNumberOfShards '1' -SolrMaxShardNumberPerNode '1' ; `
Remove-Item -Path C:\custom_master_index -Recurse -Force;

After doing all these steps, I am getting following error & hence solution is not getting built :

Invoke-SolrWebRequest Exception

Also, I am not using any custom script, I have been running the script (New-SolrCore.ps1) which is already a part of default solr-init running container.

Can anyone please help me out?


  • Have you tried this ? koenheye.be/sitecore-101-custom-solr-indexes Dec 22, 2021 at 3:25
  • Yes, I did. It creates custom indexes in solr, but doesn't provide any information about custom schema, and due to that, custom indexes which got created doesn't appear in Sitecore as well.
    – Anvay
    Dec 22, 2021 at 5:54
  • That link gives you a high level instructions on how to apply your own custom solr schema Dec 22, 2021 at 7:24
  • @AnvayJoshi were you able to figure this out? I'm receiving the same error. Jan 16, 2022 at 17:25
  • @creativeflood No, I haven't yet.
    – Anvay
    Jan 18, 2022 at 0:04

2 Answers 2


I was able to accomplish this setup with very little configuration in Sitecore 10.2 with Docker.

The following example was from an SXA setup but you can adapt to meet your needs.

Step 1

Create a new JSON configuration file called cores-sxa-custom.json and place under .\docker\build\solr-init. On startup of the solr-init container these new cores will be created automatically. I also found that by keeping the naming convention consistent with the default (e.g. sitecore_[SOMETHING_CUSTOM]_index) there is no need to do anything special with the PowerShell scripts.

    "sitecore": [

Step 2

Create or update the Dockerfile to contain something like the following and then add to the build section of your docker-compose.override.yml.

# escape=`


FROM ${SXA_IMAGE} as sxa

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Add SXA module
COPY --from=sxa C:\module\solr\cores-sxa.json C:\data\cores-sxa.json

COPY .\cores-sxa-custom.json C:\data\cores-sxa-custom.json

I do not have a local setup to try this out but this could be due to the wrong SolrEndpoint parameter.

Can you pass solr endpoint instead of C:\data? Because that parameter is being used to form solrurl by Invoke-SolrWebRequest method.

RUN C:\New-SolrCore.ps1 -SolrEndpoint C:\data 
  • I did try using "solr:8983/solr" as the SolrEndpoint (This is mentioned in the solr-init container env variable), but even after that, I am getting the same error.
    – Anvay
    Dec 23, 2021 at 6:18

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.