Distroless: An Update

sukalpo mitra
1 min readAug 31, 2022

--

Sometime back, I wrote a blog on distroless — https://medium.com/p/30a1f876f5d1.

Then recently started writing a spring boot app on the latest spring boot and jib version.

And I found that minor things have changed, so I thought of writing a little update on the implementation part of the jib.

The latest version of the “jib-maven-plugin” I am using now is 3.2.1.

The first thing I see is that the default image is no longer distroless but eclipse-temurin:8-jre.

To rectify this, we have to add a “from” configuration like the below:-

<from>
<image>gcr.io/distroless/java11</image>
</from>

The second thing I found is that during compilation, a warning was shown:-

[WARNING] 'mainClass' configured in 'maven-jar-plugin' is not a valid Java class: ${start-class}

To rectify this, add the following configuration

<container>
<mainClass>com.example.ExampleApplication</mainClass>
</container>

The maven-jib-plugin should look like the below in your pom:-

<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<container>
<mainClass>com.example.ExampleApplication</mainClass>
</container>
<from>
<image>gcr.io/distroless/java11</image>
</from>
<to>
<image>vb8-user-registration-svc</image>
</to>
</configuration>
</plugin>

Additional Note:- In my last blog, I showed how you could push images to different container registries using the maven-jib-plugin. There is one more way to do this. You can keep a single plugin configuration for all your profiles, but then you can use the following maven command to push it to different container registries.

mvn clean package jib:build -Djib.to.image=<image_registry>/<image_name>:<tag>

The main point to note here is that you use “jib:build” rather than “jib:dockerBuild”.

I hope this helps all the readers. Until next time!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response