I have a Solr backend which I want to work with a Flask frontend. I'm planning to run both in Docker using docker-compose
.
The relevant part of my docker-compose.yml
looks like this:
version: '3'
services:
solr:
image: solr
ports:
- "8983:8983"
volumes:
- ./data:/var/solr/
entrypoint:
- bash
- "-c"
- "precreate-core stable; precreate-core unstable; precreate-core archive; exec solr -f"
[...]
volumes:
data:
It creates on the host a persistent ./data
directory, which is mounted on the guest to /var/solr
. However, when I try to run it:
pc% docker-compose up
[+] Running 2/0
⠿ Container src-solr-1 Recreated
⠿ Container src-frontend-1 Recreated
Attaching to src-frontend-1, src-solr-1
src-solr-1 | Executing /opt/solr/docker/scripts/precreate-core stable
src-solr-1 | cp: cannot create directory '/var/solr/data/stable': No such file or directory
src-solr-1 | Executing /opt/solr/docker/scripts/precreate-core unstable
src-solr-1 | Executing /opt/solr/docker/scripts/precreate-core archive
src-solr-1 | cp: cannot create directory '/var/solr/data/unstable': No such file or directory
src-solr-1 | cp: cannot create directory '/var/solr/data/archive': No such file or directory
src-solr-1 |
src-solr-1 | Solr home directory /var/solr/data not found!
src-solr-1 |
src-solr-1 exited with code 1
src-frontend-1 exited with code 0
The ./data
folder remains empty.
I've already chown
ed it to 8983:8983
, so it shouldn't be a permissions issue.
The error message is complaining the data
directory missing inside /var/solr - and not /var/solr itself missing. You'll have to create the /data
directory first, then let the cores be created inside that directory.