【问题标题】:Running jenkins on docker to simulate red hat linux在docker上运行jenkins来模拟red hat linux
【发布时间】:2017-01-09 15:42:57
【问题描述】:

我对 Docker 很陌生。 我正在使用 mac OS,并且我有一个本地 Jenkins 服务器启动并运行。我想通过使用docker来模拟red hat Linux环境。 我应该执行以下步骤,

  1. 获取 RHEL 的 docker 镜像 - (Red Hat Enterprise Linux) 我应该从哪里获得 RHEL 的 docker 映像?

  2. 为 JDK、Jenkins 拉取镜像。

  3. 运行 jenkins 服务器并设置新作业

    以上步骤是否正确? 我的方向正确吗?

【问题讨论】:

    标签: linux jenkins docker dockerfile rhel


    【解决方案1】:

    您将需要创建一个自定义 Dockerfile,因为默认情况下 Jenkins 在 Alpine 或 OpenJDK 映像上运行。反过来,OpenJDK 映像基于基于 Debian 的特定版本的 buildpack-deps。 While you can create a dockerfile with multiple FROM statements, it is buggy and I wouldn't recommend it.

    获取 RHEL 的 docker 映像 - (Red Hat Enterprise Linux) 我应该从哪里获取 RHEL 的 docker 映像?

    根据我能找到的(我保留对此有错误的权利,因为我通常不在 docker 环境中使用 RHEL),there is no official RHEL image for docker. 那篇文章介绍了如何创建一个。或者,有 centos 图像,所以这可能是你最好的课程。如果不损害官方 RHEL,那么您就会被困在文章所述的地方,或者相信 Some Person 制作的非官方图像。

    为 JDK、Jenkins 拉取镜像。

    整理完上述内容后,您需要开始构建 Dockerfile 以适应 Jenkins。我会看看OpenJDK8Jenkins Dockerfile 将它(在可能的范围内)移植到 Redhat/Centos

    运行 jenkins 服务器并设置新作业

    其他部分完成后就很容易了。您可以按照official Jenkins Docker hub的指示进行操作

    我的方向正确吗?

    在我看来不是。 Docker 不应该真正用于测试这样的环境。首先,它不会是一个真正好的测试,因为如果您希望在非 docker 环境中运行它,它实际上是一个 chroot/“特殊”环境。如果您打算希望在 docker 中运行它,那么您就是在重新发明轮子,因为您已经有了一个官方的 Jenkins 镜像。

    【讨论】:

      猜你喜欢
      • 2014-03-17
      • 1970-01-01
      • 2013-03-03
      • 2023-03-29
      • 2018-01-31
      • 2014-10-29
      • 1970-01-01
      • 1970-01-01
      • 2019-07-09
      相关资源
      最近更新 更多