Last changed
docker pull cgr.dev/chainguard/maven
Need access to a specific version? Contact us.
Get notified of upcoming product changes, critical vulnerability notifications and patches and more.
Sign InMinimal image with Maven build system.
The image is available on cgr.dev
:
Chainguard Maven images come with different versions of OpenJDK, ensure you choose the correct image tag for your application needs. In these examples we will use a Chainguard Maven image based on OpenJDK 17.
Check the maven version
Visit https://start.spring.io
Select the following options:
Maven Project
2.7.5
jar
17
that matches the OpenJDK image version we are building withSpring Web
Go to your downloaded zip file, unzip
You now have your generated Spring Boot application souce code. Now let's build it.
Check to see your compiled jar
file
You should see...
Let's run the application using the Chainguard OpenJDK JRE image. Note there's a few things happening here and this is just for test purposes, see section below for more real world scenarios.
Choose the Chainguard OpenJDK JRE image tag that matches your application's Java version selected when generating your Spring Boot application above.
Now visit the Spring Boot Application in your browser using the same port mapped in the docker command above.
Note this is the expected Spring Whitelabel error page.
The steps above are useful to test Chainguard images however, we can now create a multistage Dockerfile that will build a smaller image to run our demo application.
First create a .dockerignore
file so we don't copy the generated maven ./target
folder from the steps above into the multistage docker build. This helps avoid any permission errors during the build.
Next create the multistage Dockerfile
Build your application image
Now run your application
Again visit the Spring Boot Whitelabel page in your browser
Now let's take a closer look at your newly built image.
Check the size of your image, as this is based on Chainguard images it will only contain the Linux packages required to run your application. The reduces the number of packages that can be affected by CVEs.
You can also check for vulnerabilities using your favorite scanner.
Chainguard Images contain software packages that are direct or transitive dependencies. The following licenses were found in the "latest" version of this image:
Apache-2.0
BSD-3-Clause
Bitstream-Vera
FTL
GPL-2.0-only
GPL-2.0-or-later
IJG
For a complete list of licenses, please refer to this Image's SBOM.
Software license agreement