如何在标准 openjdk docker 镜像上安装 Git?
最近开始将我的应用程序从 JDK 8 升级到 17。
我的构建基础设施使用 Docker 容器。以前,我使用的是openjdk:8u322-jdk
。因此,我将 docker 镜像升级为 openjdk:17.0.2-jdk
,但情况发生了巨大变化。
现在默认没有安装 Git,我认为底层操作系统已经改变,默认的 CMD 是“jshell”,无论那是什么 o_O
我不想花时间去创建我自己的 docker 镜像并安装所需的工具。 最终,我只需要在构建容器上运行两个命令:git clone
和 gradlew
。
我需要运行什么来安装 Git,以便可以运行 git clone
和 gradlew
?
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
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
microdnf install git
安装 git。如果要连接并运行命令,则需要显式执行 bash。
microdnf install git
to install git.Need to execute bash explicitly if you want to connect and run commands.