Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 449
Shorn Avatar asked Oct 25 '25 12:10

Shorn


1 Answers

microdnf install git to install git.

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

like image 78
Shorn Avatar answered Oct 27 '25 01:10

Shorn