Monday, October 06, 2014

JGroups and Docker

I've uploaded an image with JGroups and a few demos to DockerHub [2].

The image is based on Fedora 20 and contains JGroups, plus a few scripts which run a chat demo, a distributed lock demo and a distributed counter demo.

To run this, it's as simple as executing

docker run -it belaban/jgroups

This will drop you into a bash shell and you're ready to run any of the three demos.

Start multiple containers and you have a cluster in which you can try out things, e.g. a cluster node acquiring a lock, another node trying to acquire it and blocking, the first node crashing and the second node finally acquiring the lock etc.

Note that this currently runs a cluster on one physical box. I'll still need to investigate what needs to be done to run Docker containers on different hosts and cluster them [3].

The Dockerfile is at [1] and can be used to derive another image from it, or to build the image locally.





  1. Physical box means on single IP (single JVM). How can provide multiple IPs while using UDP.xml

  2. You can run multiple JVMs on the same box, but spanning multiple boxes hasn't been done yet. I guess that's more a missing feature of Docker than JGroups though...

    1. My requirement is using multiple IPs on multiple boxes using JGroups. How can I achieve those configuration. Please guide me.

    2. It will be great if you can provide me your email id.
      my email id -

    3. Hi Bela,

      Can you please suggest using JGroups how to write and run same application in multiple boxes as cluster.

      Thanks in advance,

  3. Chandra: belaban at yahoo dot com, but I suggest post to the JGroups mailing lists for questions on JGroups.

    Hemant: what do you mean ? I also suggest the mailing list rather than the blog for questions on JGroups.