BT

InfoQ Homepage News Containerizing Java Applications with Jib

Containerizing Java Applications with Jib

This item in japanese

Bookmarks

Jib, the open source tool for building space efficient and optimized Docker and OCI images for Java applications, has been constantly adding new features to further improve the developer and CI/CD experiences. Some of the highlights include the Jib Plugin Extension Framework, native support for popular application frameworks, CI/CD performance improvements, and enhanced development experience on a local Kubernetes with Skaffold.

Jib Plugin Extension Framework

Jib’s true power is in its ability to build optimized Docker and OCI images for Java applications reproducibly, in a declarative manner, applying container best practices, and without a Docker daemon. With the new Jib Plugin Extension Framework, users can now extend Jib to tweak all aspects of a Java application image. The extension framework is based on the Container Build Plan Specification, a general purpose, tool-agnostic spec to describe an image's build plan. The core Jib team has already released a few useful extensions like the GraalVM native image extension for a fast startup of Java applications running inside containers. New extensions can be built and contributed as thrid-party plugins for both Maven and Gradle.

Native Support for Application Frameworks

Some of the popular application frameworks like Spring Boot and Quarkus now enjoy native support from Jib. For Spring Boot, the packaged containerizing-mode in Jib provides out-of-the-box support by containerizing the original thin application JAR rather than the fat Spring Boot JAR, which tends to be unsuitable for containerization. The Jib core team has also published first-party Jib Maven and Gradle extensions for Quarkus which enable full control on how to configure and build Quarkus images. Note that these extensions are still experimental and may fail to build complex projects.

Enhanced CI/CD Support

Since Jib does not rely on the Docker daemon, it can create and push an image without downloading its corresponding base image. For instance, a typical Java based Dockerfile would contain a line like FROM openjdk:11-jre-slim to specify the base image. The Docker daemon would then have to download this base image if it is not present in the Docker image cache, which is typically the case in a CI/CD environment. But Jib has some built-in smarts that makes a best case effort to skip downloading the base images. Incorporating Jib in the CI/CD pipelines can thus reduce build times, and save network bandwidth and storage space.

Local Kubernetes Development Support with Skaffold

Skaffold, an optimized tool that provides fast and repeatable local Kubernetes development workflow, can now be integrated with Jib. This integration enables Skaffold’s zero-config auto sync for Java images. With auto sync, Jib can sync class file changes and resource file changes to a running container without the need for rebuilding and redeploying the container/pod. Note that this setup only works with exploded, non-WAR applications, which is the default build mode of Jib. In addition, the underlying Java application servers should also support reload or restarts.

The project’s samples section provides a few examples to get started with Jib.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.