In your docker-compose.yml, define the SolrCloud services. You’ll typically have:
Here’s an example docker-compose.yml for a basic setup:
version: '3' services: zookeeper: image: zookeeper:3.6 ports: - "2181:2181" environment: ZOO_MY_ID: 1 ZOO_SERVERS: server.1=zookeeper:2888:3888
image: solr:8.11 ports: - "8983:8983" environment: SOLR_CORE_CONF: solrconfig.xml SOLR_HEAP: 512m SOLR_JAVA_MEM: "-Xmx1g -Xms1g" SOLR_OPTS: "-DzkHost=zookeeper:2181 -DnumShards=2" depends_on: - zookeeper entrypoint: - docker-entrypoint.sh - solr-precreate - gettingstarted
image: solr:8.11 ports: - "8984:8983" environment: SOLR_CORE_CONF: solrconfig.xml SOLR_HEAP: 512m SOLR_JAVA_MEM: "-Xmx1g -Xms1g" SOLR_OPTS: "-DzkHost=zookeeper:2181 -DnumShards=2" depends_on: - zookeeper entrypoint: - docker-entrypoint.sh - solr-precreate - gettingstarted
In this example:
zookeeper service uses the zookeeper:3.6 image.
solr1 and solr2 services use the solr:8.11 image, connect to ZooKeeper (zookeeper:2181), and define their configurations (SOLR_CORE_CONF, SOLR_HEAP, SOLR_JAVA_MEM, SOLR_OPTS).
Start SolrCloud: Navigate to the directory containing your docker-compose.yml file and run: