How to configure Solr core with Docker4drupal for Drupal 8

Mykola Veryha
2 min readDec 30, 2019

My configurations from .env file

PROJECT_BASE_URL = lexis.loc
PROJECT_NAME = lexis.

Go into solr container (PROJECT_NAME — from .env file )

docker exec -ti -e COLUMNS=80 -e LINES=24 PROJECT_NAME_solr sh

After that you can create a core with default schema.xml and other default configurations. It can be more easier to connect to the Solr server.

$ /opt/solr/bin/solr create_core -c dev_core

Or you can create a core with one of prepared configsets in /opt/docker-solr/configsets/ directory.

I will use search_api_solr_8.x-3.2.

$ /opt/solr/bin/solr create_core -c stage -d /opt/solr/server/solr/configsets/search_api_solr_8.x-3.2/conf/

Then go to web solr panel. The web panel should be available on this subdomain http://solr.PROJECT_BASE_URL/solr/

http://solr.lexis.loc/solr/

Solr web panel

Drupal 8

Install Search API Solr module. Go to Home » Administration » Configuration » Search and metadata » Search API, create a new server or edit the default one. In expanded CONFIGURE SOLR BACKEND field set specify:

HTTP protocol: http
Solr host: solr
Solr port: 8983
Solr path: /
Solr core: dev_core

I have these configurations

Useful links:

--

--