Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nisaacson/docker-solr
Run solr inside a docker container
https://github.com/nisaacson/docker-solr
Last synced: about 1 month ago
JSON representation
Run solr inside a docker container
- Host: GitHub
- URL: https://github.com/nisaacson/docker-solr
- Owner: nisaacson
- Created: 2014-02-06T04:04:33.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-01-29T08:35:08.000Z (almost 8 years ago)
- Last Synced: 2024-04-14T14:46:35.045Z (7 months ago)
- Language: Shell
- Size: 129 KB
- Stars: 1
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Docker Solr
===========Builds a docker image for `solr-4.2.0`
# Usage
```bash
# start a solo solr server
vagrant up --provision
```Open your browser to `http://localhost:8983/solr/`. You should see the Apache Solr admin page.
# Building
To build a docker image, use the included Vagrantfile to launch up a virtual machine with docker already installed. The Vagrantfile uses the [vagrant docker provisioner](http://docs.vagrantup.com/v2/provisioning/docker.html) to install docker
**Requirements**
* [Vagrant](http://www.vagrantup.com/)
To launch the vagrant virtual machine
```bash
cd /path/to/this/repo
vagrant up
```Once the virtual machine is running you can test out the `Dockerfile` via
```bash
# log into the virtual machine
vagrant ssh
# go to the mounted shared folder
cd /vagrant/app# build a docker image from the Dockerfile
docker build -t solr .# ensure that the image exists, you should see the `solr` image in the list output
docker images# run the container, mapping ports on the host virtual machine to the same ports inside the container
ID=$(docker run -d -p 1111:22 -p 8983:8983 solr)# wait a few seconds and then check the logs on the container, you should see the output from solr starting up.
docker logs $ID# connect to the solr service running in the container via solr http interface
curl "http://localhost:8983"# You can connect to the running container via the mapped ssh port
# password: root
ssh -p 1111 root@localhost
```# Notes
To use a custom solr data configuration and data folder, use the [volumes](http://docs.docker.io/en/latest/use/working_with_volumes/) feature of docker to mount the solr data folder inside the container at `/var/lib/solr/solr`.
The initial usage example of `vagrant up --provision` actually uses the volumes feature to mount the custom config located at `./app/solr_data` in the docker solr container.
```bash
# volumes
HOST_SOLR_VOLUME=/home/vagrant/app/solr_data # used by default vagrant docker provisioner
CONTAINER_SOLR_VOLUME=/var/lib/solr/solr # Hard coded in ./app/supervisord.conf# ports
HOST_SSH_PORT=1111
CONTAINER_SSH_PORT=22
HOST_SOLR_PORT=8983
CONTAINER_SOLR_PORT=8983docker run \
-d # detached
-name solr-container
-p $HOST_SSH_PORT:$CONTAINER_SSH_PORT \
-p $HOST_SOLR_PORT:$CONTAINER_SOLR_PORT \
-v $HOST_SOLR_VOLUME:$CONTAINER_SOLR_VOLUME
solr # image name
```