Sitemap
Hari Prasad Nattuva

Hari Prasad Nattuva

Technology professional with 18 years of experience in enterprise software dev, legacy-to-cloud transformation, architecture, and scalable application delivery.

How to Create a Java Application Docker Image Using Jib Without a Dockerfile

2 min readMay 31, 2026

--

Press enter or click to view image in full size

Containerising Java applications is a common requirement in modern development and DevOps workflows.

Most developers use Dockerfiles to create container images. However, maintaining Dockerfiles for every Java application can become repetitive and error-prone.

This is where Jib becomes very useful.

Jib is an open-source tool from Google that allows developers to build optimized Docker and OCI images for Java applications without writing Dockerfiles.

In this article, I will show how to create a Java application image using Jib step by step.

What is Jib?

Jib is a container image build tool for Java applications.

It integrates directly with:

  • Maven
  • Gradle

Jib simplifies containerisation by:

  • removing the need for Dockerfiles
  • optimising image layers
  • improving build speed
  • integrating easily into CI/CD pipelines

Official GitHub:
https://github.com/GoogleContainerTools/jib

Prerequisites

Before starting, ensure the following tools are installed:

  • Java 17 or later
  • Maven or Gradle
  • Docker Desktop (optional for local testing)

Step 1 — Create a Simple Spring Boot Application

You can use any Java application.

For this example, I am using a simple Spring Boot application.

Get Hari Prasad Nattuva’s stories in your inbox

Join Medium for free to get updates from this writer.

Project structure:

demo-app
├── src
├── pom.xml
└── mvnw

Step 2 — Add Jib Maven Plugin

Add the following plugin inside the build section of pom.xml.

<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.4.3</version>
    <configuration>
<to>
<image>demo-app:jib</image>
</to>
</configuration>
</plugin>

Step 3 — Build Docker Image Using Jib

Run the following Maven command:

mvn compile jib:dockerBuild

This command creates the Docker image directly without needing a Dockerfile.

Step 4 — Verify Docker Image

Run the following command:

docker images

You should see an image similar to this:

REPOSITORY   TAG       IMAGE ID       CREATED
demo-app jib xxxxxxxx 1 minute ago

Step 5 — Run the Container

Start the container using:

docker run -p 8080:8080 demo-app:jib

Now open:

http://localhost:8080

Your application should be running successfully.

Why Use Jib?

Jib provides several advantages compared to traditional Dockerfiles.

1. No Dockerfile Required

Developers can build images directly from Maven or Gradle.

2. Faster Incremental Builds

Jib separates dependencies and application layers efficiently.

This improves caching and reduces rebuild times.

3. Better CI/CD Integration

Jib works well in automated pipelines.

4. Optimized Java Images

Jib generates smaller and cleaner images for Java applications.

Common Commands

Build to Local Docker

mvn compile jib:dockerBuild

Build Directly to Container Registry

mvn compile jib:build

Conclusion

Jib is an excellent tool for simplifying Java containerisation.

It removes Dockerfile maintenance, improves build performance, and integrates cleanly into modern DevOps workflows.

For Java developers working with Spring Boot or enterprise applications, Jib can significantly simplify container image creation.

If you are still manually writing Dockerfiles for Java applications, Jib is definitely worth exploring.

--

--

Written by Hari Prasad Nattuva

Technology professional with 18 years of experience in enterprise software dev, legacy-to-cloud transformation, architecture, and scalable application delivery.