Install Apache SOLR 3.6 in one command using Docker

Docker is the new awesome devops solution, to easily build and deploy applications. If you don't know yet how it can help you, this post will show you how powerful it is !

Using Docker, you can build containers based on an image you previously developed (or based on someone else image). I will not go through the process of creating a new image, the Docker documentation is here for that, but I will show you how you can use one of my images to deploy a SOLR 3.6 instance in one command !

Use:

On your server/computer, just run: (see previous post to install Docker on Debian 7)

docker run -d -p 127.0.0.1:2222:22 -p IP_ADDRESS:8080:8080 -t -i tehes/solr-3.6

This will pull the solr-3.6 image from my public repository, build and run the containers. Just replace IP_ADDRESS with your server's external ip address for example.

The port 2222 of the host will be redirected to the port 22 of the container.
The port 8080 of the host will be redirected to the port 8080 of the container.

Access your container:

http://IP_ADDRESS:8080
http://IP_ADDRESS:8080/solr
http://IP_ADDRESS:8080/solr/admin/
ssh [email protected] -p 2222 (password = password // SSH only allowed from the host)

Docker special awesome point:

Now let's say you need another instance of SOLR. Easy...
You just need to rerun the same command on differents ports:

docker run -d -p 127.0.0.1:2223:22 -p IP_ADDRESS:8081:8080 -t -i tehes/solr-3.6

And the access will be:

http://IP_ADDRESS:8081
http://IP_ADDRESS:8081/solr
http://IP_ADDRESS:8081/solr/admin/
ssh [email protected] -p 2223 (password = password // SSH only allowed from the host)

The SOLR conf files of this solr-3.6 image are optimized for Drupal 7. If you need to change them, you can connect in SSH to your container, and place your files in /var/lib/tomcat6/solr/conf (don't forget to restart tomcat6, it will say "failed restart", but don't worry, tomcat6 is up !)

SOLR data are located in the container in: /solr/data

Docker repository : https://registry.hub.docker.com/u/tehes/solr-3.6/