Public | Automated Build

Last pushed: 2 years ago
Short Description
Docker image for SOLR (cloud version), works with zookeeper
Full Description


Docker image containing a standard Solr distribution.

Versions used in this docker image:

  • Solr Version: 5.4.1
  • Java 1.8.0_72

Image details:

  • Installation directory: /usr/local/apache-solr/current

Solr Docker image

To start the Solr Docker image:

docker run -i -t bde2020/solr /bin/bash

To build the Solr Docker image:

git clone
docker build -t bde2020/solr .

To create a distributed Solr index.

  • Upload Solr configuration to zookeeper
    To bootstrap the Solr configuration inside zookeeper the following files are required

    • security.json
    • clusterprops.json
    • solr.xml

    It is possible to use any available tool to upload these file to zookeeper.
    The recommended way is to use Solr's to upload Solr configuration files. This script offers the possibility to upload a whole config directory at once to zookeeper. The script is available inside a running docker image under /usr/local/apache-solr/current/server/scripts/cloud-scripts.
    The following commands upload a sample configuration from the Solr distribution and solr.xml (must be in zookeeper chroot) to zookeeper

    ./ \
    -zkhost \
    -cmd upconfig \
    -confdir ../../solr/configsets/basic_configs/conf/ \
    -confname basic_config
    ./ \
    -zkhost \
    -cmd putfile /solr.xml ../../solr.xml 

    see: for more information on setting up Solr's configuration in zookeeper.

  • Start Solr Cloud

    If the above required config files are present in a zookeeper node it is possible to start Solr in cloud mode.
    Use the following command to startup Solr in cloud mode. Note that it is recommended to use a mapped directory
    as Solr home (this will ensure that indexes survive a docker image restart). For this guide it is assumed that
    /var/lib/bde/solr will act as Solr home and that said directory is mapped to the host where the docker image runs.
    In case it doesn't already exist, the directory can be created with

    mkdir -p /var/lib/solr

    Solr Cloud is started with the following command. Notes: -f = run in foreground, -cloud = run in cloud mode, -s = use the specified directory as Solr home, -p = the port Solr will be available trough, -z = the zookeeper path with chroot

    cd /usr/local/apache-solr/current && \
    .bin/solr start \
    -f \
    -cloud \
    -s /var/lib/solr \
    -p 8983 \
  • Use Solr's HTTP API to create a the distributed index

    To create a distributed (sharded) index it is now possible to use Solr's HTTP API.

    Notes: With the above service call a new collection is created, it's name is SampleCollection, the number of shards is three, a replication factor of 1 is used and the collection will be based on the "basic_config" configuration, that was uploaded to zookeeper in the previous step.

To start Solr Docker image on Marathon:

  • Create a Marathon Application Setup in json like the one below, store it in a file (e.g. marathon-solr.json) and post it to Marathon's v2/app endpoint.

      "container": {
          "type": "DOCKER",
          "volumes": [
                  "containerPath": "/var/lib/solr",
                  "hostPath": "/var/lib/bde/solr",
                  "mode": "RW"
          "docker": {
              "network": "HOST",
              "image": "bde2020/solr"
      "mem": 1024,
      "cmd": "mkdir -p /var/lib/solr && /usr/local/apache-solr/current/bin/solr start -f -cloud -s /var/lib/solr -p 8983 -z,,",
Docker Pull Command
Source Repository