---
title: "Discussion on \"Containerizing Spring Boot Application with Jib\" | Hashnode"
description: "Discussion on \"Containerizing Spring Boot Application with Jib\". In this post, we will learn about how to create docker or OCI complaint images without installing any docker client or using Dockerfile for a Spring Boot application. We will be doing all of this with the help of Jib.\nWhat Is Jib?\n\n Jib is Java conta..."
url: "https://hashnode.com/posts/containerizing-spring-boot-application-with-jib/5fd088057b097d34759e922c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Containerizing Spring Boot Application with Jib](https://ashishtechmill.com/containerizing-spring-boot-application-with-jib?utm_source=hashnode&utm_medium=feed)

In this post, we will learn about how to create docker or OCI complaint images without installing any docker client or using Dockerfile for a Spring Boot application. We will be doing all of this with the help of Jib. What Is Jib? Jib is Java conta...

Dec 9, 2020 · 6 min read · ashishtechmill.com  
Updated Apr 8, 2021  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#springboot](https://hashnode.com/tag/springboot)
-   [#docker](https://hashnode.com/tag/docker)
-   [#docker-images](https://hashnode.com/tag/docker-images)
-   [#maven](https://hashnode.com/tag/maven)

## Written by

[Ashish Choudhary](https://hashnode.com/@iashish)

@iashish · Pune, India

  
[View profile](https://hashnode.com/@iashish)

I like writing about technical stuff that I know and learn by implementing it. Java, BigData, and Cloud enthusiast.

Ashish Choudhary is a software engineer with over 10 years of experience in tech, including design, development, and web apps. He’s an active blogger and technical writer who loves Java, Spring Boot, DevOps, and the cloud, and is a strong advocate for open source.

## Responses 1

Markdown supported · ⌘↵ to post

[Senthilkumar](https://hashnode.com/@senthil131720)

[Apr 6, 2021](https://hashnode.com/posts/containerizing-spring-boot-application-with-jib/5fd088057b097d34759e922c/comment/606c235b1ed1783ab063755e)

Really Thanks Ashish for sharing about Jib!! Really its helpful!!

When i done the similar kind of setup in my machine and getting the below error when i execute mvn compile jib:build command. Can you please help me?

Error: D:\\Senthil\\Java\\spring-jib\\spring-jib>mvn compile jib:build \[WARNING\] \[WARNING\] Some problems were encountered while building the effective settings \[WARNING\] Unrecognised tag: 'server' (position: START\_TAG seen ...<pluginGroups/>\\r\\n <server>... @7:15) @ C:\\Users\\tssen.m2\\settings.xml, line 7, column 15 \[WARNING\] \[INFO\] Scanning for projects... \[INFO\] \[INFO\] -----------------------< com.example:spring-jib >----------------------- \[INFO\] Building spring-jib 0.0.1-SNAPSHOT \[INFO\] --------------------------------\[ war \]--------------------------------- \[INFO\] \[INFO\] --- maven-resources-plugin:3.2.0:resources (default-resources) @ spring-jib --- \[INFO\] Using 'UTF-8' encoding to copy filtered resources. \[INFO\] Using 'UTF-8' encoding to copy filtered properties files. \[INFO\] Copying 1 resource \[INFO\] Copying 0 resource \[INFO\] \[INFO\] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ spring-jib --- \[INFO\] Nothing to compile - all classes are up to date \[INFO\] \[INFO\] --- jib-maven-plugin:2.7.1:build (default-cli) @ spring-jib --- \[WARNING\] mainClass, extraClasspath, jvmFlags, and expandClasspathDependencies are ignored for WAR projects \[INFO\] \[INFO\] Containerizing application to registry.hub.docker.com/hiashish/spring-boot-jib-image... \[ERROR\] I/O error for image \[registry.hub.docker.com/hiashish/spring-boot-jib-image\]: \[ERROR\] java.net.SocketException \[ERROR\] Socket Closed \[ERROR\] I/O error for image \[registry.hub.docker.com/hiashish/spring-boot-jib-image\]: \[ERROR\] java.net.SocketException \[ERROR\] Socket Closed \[INFO\] Executing tasks: \[INFO\] \[=============== \] 50.0% complete \[INFO\] > scheduling building manifests \[INFO\] > launching layer pushers \[INFO\] > scheduling pushing container configurations \[INFO\] \[INFO\] ------------------------------------------------------------------------ \[INFO\] BUILD FAILURE \[INFO\] ------------------------------------------------------------------------ \[INFO\] Total time: 14.601 s \[INFO\] Finished at: 2021-04-06T14:21:34+05:30 \[INFO\] ------------------------------------------------------------------------ \[ERROR\] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:2.7.1:build (default-cli) on project spring-jib: Build image failed, perhaps you should make sure your credentials for 'registry.hub.docker.com/hiashish/spring-boot-jib-image' are set up correctly. See [github.com/GoogleContainerTools/jib/blob/master/d…](https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized) for help: Unauthorized for registry.hub.docker.com/hiashish/spring-boot-jib-image: 401 Unauthorized \[ERROR\] HEAD [registry.hub.docker.com/v2/hiashish/spring-boot-j…](https://registry.hub.docker.com/v2/hiashish/spring-boot-jib-image/blobs/sha256:3bb6e0856b81a5b7eb18584843266c2c7bb0377054645660999d0e7ae54f773e) \[ERROR\] -> \[Help 1\] \[ERROR\] \[ERROR\] To see the full stack trace of the errors, re-run Maven with the -e switch. \[ERROR\] Re-run Maven using the -X switch to enable full debug logging. \[ERROR\] \[ERROR\] For more information about the errors and possible solutions, please read the following articles: \[ERROR\] \[Help 1\] [cwiki.apache.org/confluence/display/MAVEN/MojoExe…](http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException)

Settings.xml: <settings xmlns="[maven.apache.org/SETTINGS/1.0.0"](http://maven.apache.org/SETTINGS/1.0.0%22) xmlns:xsi="[w3.org/2001/XMLSchema-instance"](http://www.w3.org/2001/XMLSchema-instance%22) xsi:schemaLocation="[maven.apache.org/SETTINGS/1.0.0](http://maven.apache.org/SETTINGS/1.0.0) [maven.apache.org/xsd/settings-1.0.0.xsd">](https://maven.apache.org/xsd/settings-1.0.0.xsd%22%3E) <localRepository/> <interactiveMode/> <offline/> <pluginGroups/> <server> <id>registry.hub.docker.com</id> <username>username</username> <password>password</password> </server> <mirrors/> <proxies/> <profiles/> <activeProfiles/> </settings>

[Ashish Choudhary](https://hashnode.com/@iashish)

[Apr 6, 2021](https://hashnode.com/posts/containerizing-spring-boot-application-with-jib/5fd088057b097d34759e922c/comment/606c235b1ed1783ab063755e#reply-606c4d561ed1783ab06378ea)

[Senthilkumar](https://hashnode.com/@senthil131720) Do you mind sharing the docker run command you have used to start the container?.

[Ashish Choudhary](https://hashnode.com/@iashish)

[Apr 6, 2021](https://hashnode.com/posts/containerizing-spring-boot-application-with-jib/5fd088057b097d34759e922c/comment/606c235b1ed1783ab063755e#reply-606c4f341ed1783ab06378f4)

[Senthilkumar](https://hashnode.com/@senthil131720) I have never explicitly passed username and password while running jib:build. You can check the [documentation](https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin#build-your-image) for more details. I have not passed any credentials explicitly in the demo video, so it should pick up from the setttings.xml file.

[Senthilkumar](https://hashnode.com/@senthil131720)

[Apr 6, 2021](https://hashnode.com/posts/containerizing-spring-boot-application-with-jib/5fd088057b097d34759e922c/comment/606c235b1ed1783ab063755e#reply-606c5d88b17dc439b747ecc9)

Hi Ashish,

All setup are done now when i try to execute docker run command using docker run -it --rm -p 8080:8080 senthil131720/demo getting below error. I have installed Docker in my machine. Please advice. Thanks again!

D:\\Senthil\\Java\\spring-jib\\spring-jib>docker run -it --rm -p 8080:8080 senthil131720/demo Error: -jar requires jar file specification Usage: java \[options\] <mainclass> \[args...\] (to execute a class) or java \[options\] -jar <jarfile> \[args...\] (to execute a jar file) or java \[options\] -m <module>\[/<mainclass>\] \[args...\] java \[options\] --module <module>\[/<mainclass>\] \[args...\] (to execute the main class in a module) or java \[options\] <sourcefile> \[args\] (to execute a single source-file program)
