How to Choose the Right Maven Docker Image and Know What's Included?

February 24, 2026 2 answers
Asked by ROLLER_derby
I'm working on a GitLab job that uses a Maven Docker image, specifically *maven:3.8.5-openjdk-17*, and I want to upgrade to Maven 3.9 while still using Java 17. I noticed that there isn't a 3.9 image with "openjdk-17" in its name, so I picked *3.9.12-eclipse-temurin-17-alpine* randomly. I've run into issues because the location of the cacerts file has changed in this new image; it's located at */opt/java/openjdk/lib/security/cacerts* instead of */usr/java/openjdk-17/lib/security/cacerts*. I stumbled upon this by chance. Furthermore, unlike the previous image, the *git* command isn't included by default in this new one, so I switched to a -noble version instead of -alpine, which worked out for me. I'm finding this process a bit confusing and feel I've resolved my challenges through luck. How can I make an informed decision when choosing an image? Is there a reliable way to check if certain commands like Git are included? And how do I find the correct path for *cacerts*? Thanks for any insights!

Answers

..undo
To figure out which image to use, check the naming conventions in the Maven Docker Hub readme. Google is your friend for understanding the terminologyโ€“like alpine and temurin. For the cacerts path, if you are using `keytool` to update it, just use `-cacerts`, and itโ€™ll handle the rest. If you need to overwrite it with a custom keystore, you'll likely need to find that file based on the JDK installation path. To see if git is included or not, look through the image's source repo or run a container based on the image to check directly. Tools like Dive can also help you inspect the image thoroughly.
Reply to this answer
budget.line.item
You can definitely find newer Maven versions with openjdk 17 on Docker Hub. It's best to stick to the official Maven images from the Maven team rather than switching to Alpine-based images from others, as there are significant differences in tooling. Just be cautious when changing between base imagesโ€”those differences can bring unexpected issues.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions