It is now even easier to get started with Solr: you can run Solr on Docker with a single command:

$ docker run --name my_solr -d -p 8983:8983 -t solr

That creates a new Docker container using the new official Solr image, which includes OpenJDK and the latest release of Solr.

Then with a web browser go to http://localhost:8983/ to see the Admin Console (adjust the hostname for your docker host).

To use Solr, you need to create a “core”, an index for your data. For example:

$ docker exec -it --user=solr my_solr bin/solr create_core -c gettingstarted

In the web UI if you click on “Core Admin” you should now see the “gettingstarted” core.

If you want to load some example data:

$ docker exec -it --user=solr my_solr bin/post -c gettingstarted example/exampledocs/manufacturers.xml

In the UI, find the “Core selector” popup menu and select the “gettingstarted” core, then select the “Query” menu item. This gives you a default search for “:” which returns all docs. Hit the “Execute Query” button, and you should see a few docs with data. Congratulations!

This video demonstrates the image used with the user interface (Kitematic) from the Docker Toolbox on OSX:

 

Further instructions, including on how to run in a multi-container configuration can be found in the documentation, with further details in the FAQ. The code for this image is available in the docker-solr Github repository.

For those interested in how this came together: the image is based on the popular makuk66/docker-solr image, and you can see how that was further refined to be even friendlier to use and to better fit into Docker’s maintenance model in this pull request. A big thank-you to the Docker team for their help there.

About Martijn Koster

Read more from this author

Best of the Month. Straight to Your Inbox!
Dive into the best content with our monthly Roundup Newsletter! Each month, we handpick the top stories, insights, and updates to keep you in the know.