On some computers, I've found that Sitecore's standard developer image for Solr does not start reliably. I wrote about the behaviour of the issue and some early attempts to fix it on my blog a while back.
This repository holds an example for how to modify the standard Sitecore image to use a separate instance of ZooKeeper instead of the internal one that SolrCloud can use. This seems to resolve the startup issues for me. I've written up this work on my blog too if you want to understand what the assorted changes do.
For simplicity, I've added some shortcut scripts. Once you've cloned the repository, you can:
- Run
build.ps1
to get Docker to build the custom image - Run
up.ps1
to start SolrCloud and run Sitecore'ssolr-init
job image - Run
down.ps1
to stop the containers
Other than for testing, it's not expected that you'd use this on its own. It's an example for what changes you might make to your existing project's docker config to enable this approach for your work.
This was worked out as an extension to Sitecore's v10.2 docker config, but by changing the base image versions for Sitecore, Solr and Solr-Init in the compose and environment files, it should work with most recent versions. v10.3's OTB docker compose files seem to run fine with it. But I've not tested others (or other customisations to docker config) myself.
Questions or comments? I'm on Mastodon and also @jermdavis on Sitecore Slack.