SERVER, DOCKER ~ JUNE 06 2024

Solr in a Windows Docker Container

Docker is great & so is Solr but as I recently found, Developers don't always have their first choice of server to put them on. Docker works great and a lot of well known platforms & tooling have their own pre-built Images that you can use in your projects. Solr's official Image is one such resource, readily available from the Docker Hub.

What you quickly notice, is the general lack of support for Windows containers from most of the software vendors out there. The only platform I have come across with Windows support, out of the many I've used since becoming familiar with Docker, is portainer. You could give up on Docker and maintain the platform you need directly on your servers root but the benefits of Docker, for me, made it worth at least trying to create my own Docker setup for Solr in a Windows Container.

Where in the world do you start?

The best place to start for me, was with what I knew. I've been working with Docker for just over a year and have put together quite a few Dockerfiles & orchestrated even more Docker compose ones. Here's how easy it can be to get started with Solr using a docker-compose.yml file when the platform of choice exists within their Docker hub instance.

OK, so I have over simplified these files but there is not much too it than this. This is just an illustration of why we use Docker. We don't really need a Dockerfile but we will for the Windows Container for sure so to tie this into that, we could use a Dockerfile to create some cores as part of the build process, having included them via our Volume in the compose file. We do that like so.

Easy peasy thanks, obviously, to the wide Linux support when vendors create their images for Docker.

It also helped that I'd been tinkering around with standalone versions of Solr & got pretty familiar with how to setup configs and interact with it through the API. Knowing these things, I felt that attempting the installation part through Docker on Windows, in theory, should only involve getting Java and Solr into an image & running the right commands somehow. Of course, this was easier said than done.

Now you, Windows

Solr also moved across to a new 'cloud' architecture in later versions, much like Elasticsearch does out of the box. We would need to add zookeeper into the mix too which of course, is the first realisation of the aformentioned 'easier said than done' piece.

I definately wanted a forward-thinking cloud environment for Solr, so tackling the zookeeper side of things was unavoidable. First things first though, I know that most of the work will be inside the Dockerfile but we need to centralise setup in docker-compose.yml.

If you've setup Solr recently, this will look familiar. I've allowed for a basic one node setup for zookeeper here with the main solr container being dependant on it for instance & collection management.

Portainer is a useful extra here to just inspect and look around your containers and internals via port 9000. There is also a Windows container version, a rarity and useful when you want to inspect your containers on the Windows Server without having to go through the command line, as you won't have the benefit of Docker Desktop to do that.

To see the full code click the link below: