Google Simplifies Java Containerization with New Tool
- By John K. Waters
- July 11, 2018
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 K. Waters is the editor in chief of a number of Converge360.com sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS. He can be reached at [email protected].