Jib – Containerize Your Java Application

Building containerized applications require a lot of configurations. If you are building a Java application and planning to use Docker, you might need to consider Jib. Jib is an opensource plugin for Maven and Gradle. It uses the build information to build a Docker image without requiring a Dockerfile and Docker daemon. In this article, we will build a simple Spring Boot application with Jib Maven configuration to see Jib in action. The pom.xml configuration with Jib is given below.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
      <relativePath />
      <!-- lookup parent from repository -->
   <description>Demo project for Spring Boot</description>
   <!-- The below configuration is for Jib -->
		        <!-- I configured Docker Image to be pushed to DockerHub -->
		        <!-- Used simple Auth mechanism to authorize DockerHub Push -->

After the above change, use the below Maven command to build the image and push that image to DockerHub. If you face any authentication issues with DockerHub, refer

mvn compile jib:build

Now, pull the image which we created with the above command to run it.

docker image pull 2013techsmarts/jib-demo
docker run -p 8080:8080 2013techsmarts/jib-demo

That’s it. No more additional skill is required to create a Docker Image.

Published on Java Code Geeks with permission by Siva Janapati, partner at our JCG program. See the original article here: Jib – Containerize Your Java Application

Opinions expressed by Java Code Geeks contributors are their own.

Siva Janapati

Siva Prasad Rao Janapati is an Architect. He has hands on experience on Java, JEE, Spring, Oracle Commerce, MOZU Commerce, Apache Solr, Apache Kafka, Node.js, JBoss, Hibernate, Memcached, MySql, Oracle, MongoDB, APIGEE, Cloud Native, BlockChain and other open source/enterprise technologies. He loves to explore new technologies and trends.
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Back to top button