Apache Solr (Built with Ansible Container)
This project is in it's early stages. There will be bugs! You may be better served using the official Solr Docker image if it meets your requirements.
This project is composed of three main parts:
- Ansible Container project: This project is maintained on GitHub: geerlingguy/solr-container. Please file issues, support requests, etc. against this GitHub repository.
- Docker Hub Image: If you just want to use the
geerlingguy/solrDocker image in your project, you can pull it from Docker Hub.
- Ansible Role: If you need a flexible Ansible role that's compatible with both traditional servers and containerized builds, check out
geerlingguy.solron Ansible Galaxy. (This is the Ansible role that does the bulk of the work in managing the Apache Solr container.)
Currently maintained versions include:
latest: Apache Solr 6.x
5.5.4: Apache Solr 5.x
4.10.4: Apache Solr 4.x
3.6.2: Apache Solr 3.x
If you want to use the
geerlingguy/solr image from Docker Hub, you can quickly build a Solr container locally with:
docker run -d --name=solr -p 8983:8983 geerlingguy/solr:latest /opt/solr/bin/solr start -p 8983 -s /var/solr -f -force
(For Solr 4.x, drop the final
You can also wrap up that configuration in a
Dockerfile and/or a
docker-compose.yml file if you want to keep things simple. For example:
``` version: "3" services: solr: image: geerlingguy/solr:latest container_name: solr ports: - "8983:8983" restart: always # See 'Custom and Persistent Solr cores' for instructions for volumes. volumes:  command: ["/opt/solr/bin/solr", "start", "-p", "8983", "-s", "/var/solr", "-f", "-force"]
docker-compose up -d
Now you should be able to access the Solr admin dashboard at
Custom and Persistent Solr cores
The default installation includes a
collection1 core in the
Apache Solr will autodiscover any Solr cores in
SOLR_HOME by searching for
core.properties files inside each subdirectory. A standard convention for a single Solr core is to to mount a host directory as a volume with the core directory, containing the core's
Here's an example minimal
core.properties file, for a core named
name=mysearch config=solrconfig.xml schema=schema.xml dataDir=data
So, if you have a solr core directory named
mysearch (with a
mysearch/core.properties file inside, and a
data directory for storing Solr configuration and index data, respectively), mount it as a volume like
-v ./mysearch:/var/solr/mysearch:rw. If you have multiple solr cores (all defined inside a
cores directory), mount them inside a
cores directory like
Or, if using a Docker Compose file:
services: solr: ... volumes: # If you have one core: - ./mysearch:/var/solr/mysearch:rw # If you have multiple cores: - ./cores:/var/solr/cores:rw
You can also mount volumes from a data container or elsewhere; the key is you will be able to both provide custom Solr configuration (
solrconfig.xml, etc.), and also have a persistent
data directory that lives outside the container.
Apache Solr 3.x
There are a number of differences to keep in mind if using Apache Solr 3.x:
- Apache Solr 3.x doesn't support
core.propertiesor core autodiscovery, so if you want to use a custom Solr core configuration, you should mount a volume into
/opt/solr/example/solrwith your Solr core configuration (
datadirs, at minimum).
- At this time, multicore isn't officially supported under 3.x in this Docker container.
- Apache Solr 3.x doesn't run in the foreground in the same way as 4+. You have to use the
java -jar start.jarinside the directory
/opt/solr/exampleto start Solr in the foreground.