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:
| Variable | Default | What it does |
|---|---|---|
SOLR_VERSION | 8.11 | Image tag from the official Solr image. |
SOLR_PORT | 8983 | Host-side port for both the admin UI and the API (container port 8983). |
SOLR_DATAIMPORTHANDLER_MYSQL | false | When true, downloads the MySQL Connector/J JDBC driver at build time for the DataImportHandler. |
SOLR_DATAIMPORTHANDLER_MSSQL | false | When 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
- In
.env, setSOLR_DATAIMPORTHANDLER_MYSQL=true(orSOLR_DATAIMPORTHANDLER_MSSQL=true). - Rebuild with a clean cache, since the connector is downloaded during the build:
docker compose build --no-cache solr
Common issues
- Changing
SOLR_VERSIONdoesn'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
trueat 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 toDATA_PATH_HOST/solr(mounted to/opt/solr/server/solr/mycores), confirmDATA_PATH_HOSTis set consistently between runs. - Port already in use on your host. Change
SOLR_PORTin.envand restart:docker compose up -d solr.
Need a lighter-weight search engine instead? See Manticore. Back to the Getting Started guide.