Skip to main content

Apache Solr

What is Apache Solr?

Apache Solr is a search platform built on Apache Lucene, offering full-text search, faceting, and indexing over HTTP. Laradock builds it from the official solr Docker image, with its admin UI and API on one port.

Start Solr

docker compose up -d solr

Stop Solr

docker compose stop solr

This stops the container without deleting its data. Cores live under DATA_PATH_HOST/solr.

Configuration

All settings live in solr/defaults.env and can be overridden by adding the same line to your own .env:

VariableDefaultWhat it does
SOLR_VERSION8.11Image tag from the official Solr image.
SOLR_PORT8983Host-side port for both the admin UI and the API (container port 8983).
SOLR_DATAIMPORTHANDLER_MYSQLfalseWhen true, downloads the MySQL Connector/J JDBC driver at build time for the DataImportHandler.
SOLR_DATAIMPORTHANDLER_MSSQLfalseWhen true, downloads the Microsoft JDBC driver at build time for the DataImportHandler.

Open the admin UI

http://localhost:8983/solr

Create a core

docker compose exec solr solr create_core -c mycore

Enable a JDBC data import connector

  1. In .env, set SOLR_DATAIMPORTHANDLER_MYSQL=true (or SOLR_DATAIMPORTHANDLER_MSSQL=true).
  2. Rebuild with a clean cache, since the connector is downloaded during the build:
    docker compose build --no-cache solr

Common issues

  • Changing SOLR_VERSION doesn't take effect. It's a build argument, rebuild after changing it: docker compose build solr.
  • JDBC connectors missing. They're only fetched when the matching flag was true at build time, flip the flag and rebuild with --no-cache, a plain rebuild reuses the cached layer and skips the download.
  • Cores don't persist across docker compose down. They're written to DATA_PATH_HOST/solr (mounted to /opt/solr/server/solr/mycores), confirm DATA_PATH_HOST is set consistently between runs.
  • Port already in use on your host. Change SOLR_PORT in .env and restart: docker compose up -d solr.

Need a lighter-weight search engine instead? See Manticore. Back to the Getting Started guide.