Reputation: 631
I need to create docker container with Solr that has custom configuration created. In order to create that config when installed not in docker container I need to do the following:
cp -r /opt/solr/server/solr/configsets/basic_configs /opt/solr/server/solr/configsets/myconf
Then I have to copy my custom schema.xml to that location:
cp conf/schema.xml solr/server/solr/configsets/myconf/conf
And then remove managed schema:
rm /opt/solr/server/solr/configsets/nutch/conf/managed-schema
I have this docker-compose.yml that I need to modify to do the same as commands above:
version: '3.3'
services:
solr:
image: "solr:7.3.1"
ports:
- "8983:8983"
volumes:
- ./solr/conf/solr-mapping.xml:/opt/solr/conf/schema.xml
entrypoint:
- docker-entrypoint.sh
- solr-precreate
- mycore
schema.xml can go to valumes part, but I don't really understand where should I place this first cp and rm commands.
Thanks!
Upvotes: 1
Views: 2479
Reputation: 66
You can add your commands to your docker compose file ( https://docs.docker.com/compose/compose-file/#command)
version: '3.3'
services:
solr:
image: "solr:7.3.1"
ports:
- "8983:8983"
volumes:
- ./solr/conf/solr-mapping.xml:/opt/solr/conf/schema.xml
command: 'bash -e -c "precreate-core mycore; cp /opt/solr/conf/schema.xml /opt/solr/server/solr/mycores/mycore/conf/schema.xml; cp /opt/solr/conf/solrconfig.xml /opt/solr/server/solr/mycores/mycore/conf/solrconfig.xml; rm /opt/solr/server/solr/mycores/mycore/conf/managed-schema; solr-foreground;"'
it works for me
Upvotes: 5