In a docker-compose.yml:
version: '3' services: solr: image: quay.io/continuouspipe/solr4:stable environment: SOLR_CORE_NAME: example_core volumes: - solr_data:/usr/local/share/solr/example_core/data/ volumes: solr_data: driver: local driver_opts: type: tmpfs device: tmpfs o: size=100m,uid=1000
In a Dockerfile:
How to build
docker-compose build --pull solr_4_10 docker-compose push solr_4_10
This is a Docker image that provides a Solr 4 search service that tracks the upstream library image.
How to use
As this is based off of a semi-official solr image, please see their README, here:
To tie in with the official 6.x versions of the solr image
(see the Solr library image), we provide the ability to create a core on startup.
This avoids manual intervention.
To provide this functionality,
/bin/bash -c /usr/local/share/solr/startup.sh will run on boot, which will:
- Start an instance of solr in the background, running as the solr user. This process becomes PID 1 and will have it's
stdout/stderr output tee'd to a temporary logfile.
- Wait until solr starts by checking the logfile every second for the magic string
- Once started and accepting connections, kill the
teeprocess and clean up the temporary log file.
- Check (via curl) if the core named by the environment variable
$SOLR_CORE_NAMEis present already.
- If the core isn't present already, create it, again via curl.
- Force the backgrounded solr process into the foreground, so that the current bash shell does not exit and make
the docker daemon think that the container has crashed.
The core will use the
/usr/local/share/solr/$SOLR_CORE_NAME/ directory, and you should place the desired configuration
/usr/local/share/solr/$SOLR_CORE_NAME/data/ will be created if it doesn't exist, and you should configure this to be
on a volume if you wish to keep the data between containers.