简体   繁体   English

如何在标准 openjdk docker 映像上安装 Git?

[英]How to install Git on the standard openjdk docker image?

Recently started upgrading my app from JDK 8 to 17.最近开始将我的应用程序从 JDK 8 升级到 17。

My build infrastructure uses docker containers.我的构建基础设施使用 docker 个容器。 Previously, I was using openjdk:8u322-jdk .以前,我使用的是openjdk:8u322-jdk So I bumped the docker image to openjdk:17.0.2-jdk , but things've changed drastically.所以我将 docker 图像添加到openjdk:17.0.2-jdk ,但情况发生了巨大变化。

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现在默认没有安装 Git,我认为底层操作系统已经改变,默认的 CMD 是“jshell”,不管它是什么 o_O

I don't want to spend time faffing about creating my own docker image with the needed tools installed.我不想花时间在安装所需工具的情况下创建自己的 docker 图像。 At the end of the day, I just need to run two commands on the build container: git clone and gradlew .在一天结束时,我只需要在构建容器上运行两个命令: git clonegradlew

What do I need to run to get Git installed so I can run a git clone and gradlew ?我需要运行什么才能安装 Git 以便运行git clonegradlew

microdnf install git to install git. microdnf install git安装 git。

Need to execute bash explicitly if you want to connect and run commands.如果要连接并运行命令,需要显式执行bash。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM