Google Simplifies Java Containerization with New Tool
- By John K. Waters
Google this week released a new open source tool designed to simplify the task of containerizing a Java application. The new tool, called Jib, is a fast and simple container image builder that consolidates all the steps involved in packaging an app into a container image, and allows developers to build containers using familiar Java tools.
The tool was created to streamline the tedious traditional process of containerizing a Java app -- writing a Dockerfile, running a Docker daemon as root, waiting for builds to complete, and then pushing the image to a remote registry.
"Not all Java developers are container experts," wrote Google software engineers Appu Goundan and Qingyang Chen in a blog post, "what happened to just building a JAR?"
Traditionally, a Java application is built as a single image layer with the application JAR. But the new tool separates the Java app into multiple layers for more granular incremental builds. When the code is changed, only the changes are rebuilt, not the entire app. These layers, by default, are layered on top of a distro-less base image.
"Since Jib tightly integrates with your Java build," Goundan and Chen explained, "it has access to all the necessary information to package your application. Any variations in your Java build are automatically picked up during subsequent container builds."
Consequently, the new tool frees Java developers from the need to write a Dockerfile or have Docker installed, and it's directly integrate into Maven and Gradle as plugins requiring minimal configuration.
Jib takes advantage of image layering and registry caching to allow fast, incremental builds. "It reads your build config, organizes your application into distinct layers (dependencies, resources, classes), and only rebuilds and pushes the layers that have changed," they wrote. "When iterating quickly on a project, Jib can save valuable time on each build by only pushing your changed layers to the registry instead of your whole application."
Finally, Job makes it possible to build container images declaratively from Maven and Gradle build metadata, which means it can be configured to create reproducible build images as long as the inputs remain the same.
Jib currently builds into the Docker V2.2 image format or OCI image format. It's a work in progress, the GitHub page warns, so keep an eye out for updates.
John has been covering the high-tech beat from Silicon Valley and the San Francisco Bay Area for nearly two decades. He serves as Editor-at-Large for Application Development Trends (www.ADTMag.com) and contributes regularly to Redmond Magazine, The Technology Horizons in Education Journal, and Campus Technology. He is the author of more than a dozen books, including The Everything Guide to Social Media; The Everything Computer Book; Blobitecture: Waveform Architecture and Digital Design; John Chambers and the Cisco Way; and Diablo: The Official Strategy Guide.