'How to install Git on the standard openjdk docker image?

Recently started upgrading my app from JDK 8 to 17.

My build infrastructure uses docker containers. Previously, I was using openjdk:8u322-jdk. So I bumped the docker image to openjdk:17.0.2-jdk, but things've changed drastically.

There's no Git installed by default now, I think the underlying OS has changed and the default CMD is "jshell", whatever that is o_O

I don't want to spend time faffing about creating my own docker image with the needed tools installed. At the end of the day, I just need to run two commands on the build container: git clone and gradlew.

What do I need to run to get Git installed so I can run a git clone and gradlew?



Solution 1:[1]

microdnf install git to install git.

Need to execute bash explicitly if you want to connect and run commands.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shorn