Five More Popular Java-based Docker Images
In my last post, I looked at a few Java-based Docker images that can streamline your container workflow. I highlighted some of the issues you can run into when working with Apache Hadoop, Apache Tomcat, Apache Maven, Stash, and Glassfish in containers. I also provided a few workarounds.
In this post, we’ll review five more Java-based Docker repositories, along with some of the current bugs that you might run into when working with them.
Jetty is a purely Java-based HTTP server and Java servlet container. Unlike other HTTP server offerings, Jetty is utilized by developer teams for machine-to-machine communication over enterprise-level frameworks. Jetty has become the go-to HTTP server for not only a variety of open source projects, but larger services such as the Google App Engine. Jetty servers are also powering some of the projects we covered in our previous post, including both Apache Maven and Apache Spark.
A current issue affecting some developers using Jetty alongside the Maven plugin can result in Jetty not reflecting changes that have been made to a project. When an application is run locally, the host machine will pick up the change made to the file, but this is not true when running the application in Docker. This has bug has been reproduced across many Jetty applications. A workaround to this issue is to specify a volume for the path in question, though there is no current official solution.
Jetty also appears to have some issues seeing files in a volume when being run in Docker.
Jenkins is an application that monitors the execution of repeated jobs, such as those run by cron or within a software application. Jenkins allows for development teams to build and test their projects continuously. Jenkins also monitors external jobs, including those that are run on remote machines. Jenkins provides easy access to builds, and keeps job outputs, allowing your team to review logs and address issues when they arise.
Running Jenkins with Docker can result in Jenkins not waiting for Docker commands to finish if you use the
-t option to allocate a pseudo-TTY. If you remove this option, Jeckins will wait for Docker to do what it needs to do, without returning an instant Success message.
Jenkins is also experiencing a current bug where it does not set some URL-based configuration values properly inside a container. A workaround is to log into your Jenkins instance and save the config via the adminal panel. Or, preferably, write a Jeckins init script that configures the
rootUrl according to the environment.
Cassandra is an open source database management system designed to handle large amounts of data across multiple servers. Apache Cassandra delivers high-availability alongside fault-tolerant technology. Data is automatically replicated to multiples nodes in order to test for fault tolerance, with failing nodes able to be replaced without impacting performance.
Cassandra is in use at many large companies that rely on its durability to manage their databases. The largest use of Cassandra can be seen at Apple, with over 75,000 nodes storing over 10 PB of data. Netflix, EBay, and Instagram also use Cassandra.
The Cassandra Docker image currently has a bug where it will not allow Thrift (a Java platform used for cross-language service development) to communicate with Cassandra. Specifically, running the official Docker image, Cassandra has set
false, resulting in Thrift not starting in the container.
A workaround to this issue has been posted on StackOverflow.
If you encounter this issue, you can run the following CLI script to enable Thrift:
Users are also advised to open the Thrift API port by running:
Users also report hanging when Cassandra containers restart if they are deployed on Amazon EC2 instances. When the container restarts, the nodes will appear to connect, but
nodetool status will show the Cassandra nodes as down. They reconnect after 15-45 minutes of idling, which may or may not be acceptable for your specific use-case. Currently, there is no workaround for this issue.
Mesos is a tool which abstracts CPU, memory storage, and other resources away from both physical and virtual machines. By abstracting these resources, Mesos allows developers to build fault-tolerant elastic distributed systems.
Mesos allows for a high level of cluster scaling, with support for tens of thousands of nodes. Mesos also offers a clean, clutter-free web UI for viewing the state of clusters, while providing you the ability to access other workflow applications such as Hadoop, Spark, and Elastic Search.
There is a current bug affecting Mesos on Docker where heath checks in Mesos will not work with the Docker executor. The task will appear to start, but then hangs indefinitely. Reviewing the Mesos UI displays the Health Check as gray, meaning its status is unknown.
This issue has been opened by Mesos on GitHub, with updates pending to its project documentation for both Docker and Mesos stand-alone. Mesos has yet to provide a workaround, though suggest users facing this issue set a custom executor to handle health checks.
And finally, of course, is Java itself. This image is a basic Java environment for you to run your own Java applications inside of.
Using the official Java image is a great way to get started working in containers. You can layer your application over the official image along with plugins such as Maven or Hadoop. Adding a Maven POM to your application means that your Java container will start quickly when working in it. That's because Docker will cache your app dependencies as your container is modified.
Current issues affecting the Java Docker image include the inability to use the latest version of Java if one is developing an application using Travis CI. Travis CI’s JDK switcher only supports JDK 1.8.0_31. When downloading the newest binary release, Travis CI defaults back to 1.8.0_31.
apt-get is not currently supported in the Travis CI new Docker infrastructure. Users needing to run apt commands in a Java container using Travis CI can reference the official Travis APT sources and packages documentation to install the required dependency.
In this post we looked at five Docker images:
- Jetty: an HTTP server
- Jenkins: monitors repeated task execution
- Cassandra: a high-powered distributed DBMS
- Mesos: used for abstracting resources
- Java: a base image for your Java applications
These five projects are just a few examples of Java-based Docker images you can use for your Java deployments and container-oriented Java projects.