I am using the following docker-compose.yml
and Dockerfile
to build the solr container
docker-compose.yml
version: "2"
services:
solr:
container_name: test.solr
#image: solr:5.5
build: .build/solr
ports:
- "8983:8983"
volumes:
- ./data/solr:/opt/solr/server/solr
Dockerfile
FROM solr:5.5
WORKDIR /opt/solr
RUN solr create -c drupal-solr
But the container can't be built with the following error
ERROR: Service 'solr' failed to build: The command '/bin/sh -c solr create -c drupal-search -p 8983' returned a non-zero code: 1
I have to remove the solr create
command from the Dockerfile to allow the container to be built properly.
However when I switch on the container, the solr container will exit with the following error
Solr home directory /opt/solr/server/solr must contain a solr.xml file!
How should I update my docker-compose.yml and Dockerfile to pre-create the core, and map the core directory to the local directory?
This might be because of the build and start order.
To avoid this issue you could use: