JIB — Preferred way to Containerize Java-based application

Jib builds containers without using a Dockerfile or requiring a Docker installation.

What is Containerization?

Containerization is the process of packaging software code, its required dependencies, configurations, and other detail to be easily deployed in the same or another computing environment.

containerization is the encapsulation of an application and its required environment.

To package up apps so they could be run on production systems. To do this we need some kind of virtualization layer that would allow anything to be run. Heroku was one of the first to tackle this and they used a Linux virtualization system called “lxc” — short for Linux Containers.

A bit later a Heroku competitor named dotCloud was trying to tackle similar problems and went a different route which ultimately led to Docker, a standard way to create and run containers across platforms including Windows, Mac, Linux, Kubernetes.

Ways to achieve Containerization?

  • Dockerfile
  • Buildpacks
  • JIB

Why JIB?

Simple — As developer need not maintain Dockerfile and all ways to handle it. Dev could focus majorly on the application functionality and the Gradle/Maven Jib plugin will do the rest. Actually, we don’t even have to have docker installed to create and publish the docker images ourselves.

Fast — As JIB takes advantage of caching image layers. Deploy your changes fast. Jib separates your application into multiple layers, splitting dependencies from classes. Now you don’t have to wait for Docker to rebuild your entire Java application — just deploy the layers that changed.

Reproducible — Rebuilding your container image with the same contents always generates the same image. Never trigger an unnecessary update again.

Native Approach

JIB Flow

Build an image with the Gradle JIB plugin

Note: It requires Gradle version 5.1. If your version is less than 5.1, please run gradle wrapper --gradle-version=5.1 first.

The source code repository link is mentioned below

You will not find a docker image. As JIB directly pushes the image to the registry. It doesn’t require the docker to be installed on the developer machine, unlike the native containerization approach. Isn’t it cool!

Father || Coder || Engineer || Learner || Reader || Writer