1

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?

Chito Cheng
  • 540
  • 2
  • 9
  • 25
  • i have the same issue with the solr.xml file error. i'm using volumes and pointing a relative directory with my cores in but fails (windows) – nologo Jul 11 '18 at 02:18

1 Answers1

0

This might be because of the build and start order.

To avoid this issue you could use:

FROM solr:6.6-alpine
RUN precreate-core drupal-solr
Blue
  • 22,608
  • 7
  • 62
  • 92