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

发布于 2025-01-13 18:55:49 字数 409 浏览 5 评论 0原文

最近开始将我的应用程序从 JDK 8 升级到 17。

我的构建基础设施使用 Docker 容器。以前,我使用的是openjdk:8u322-jdk。因此,我将 docker 镜像升级为 openjdk:17.0.2-jdk,但情况发生了巨大变化。

现在默认没有安装 Git,我认为底层操作系统已经改变,默认的 CMD 是“jshell”,无论那是什么 o_O

我不想花时间去创建我自己的 docker 镜像并安装所需的工具。 最终,我只需要在构建容器上运行两个命令:git clonegradlew

我需要运行什么来安装 Git,以便可以运行 git clonegradlew

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦在深巷 2025-01-20 18:55:49

microdnf install git 安装 git。

如果要连接并运行命令,则需要显式执行 bash。

microdnf install git to install git.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文