【问题标题】:Permission errors running jenkins inside docker using persistent volumes with marathon and mesos使用带有马拉松和 mesos 的持久卷在 docker 内运行 jenkins 的权限错误
【发布时间】:2016-04-04 12:46:34
【问题描述】:

我正在尝试让 jenkins 在 docker 中运行,使用 marathon 和 mesos 来午餐 jenkins docker 映像。

我使用了创建应用程序按钮,它产生以下 json

{
  "type": "DOCKER",
  "volumes": [
    {
      "containerPath": "/var/jenkins_home",
      "hostPath": "jenkins_home",
      "mode": "RW"
    },
    {
      "containerPath": "jenkins_home",
      "mode": "RW",
      "persistent": {
        "size": 200
      }
    }
  ],
  "docker": {
    "image": "jenkins",
    "network": "HOST",
    "privileged": false,
    "parameters": [],
    "forcePullImage": false
    }
}

标准输出显示

--container="mesos-c8bd5b26-6e71-4e18-b490-821dbf7edd9d-S0.ac0b4dbb-10e4-4684-a4df-9539258d77ee" --docker="docker" --docker_socket="/var/run/docker.sock" --help="false" --initialize_driver_logging="true" --launcher_dir="/home/ajazam/mesos-0.28.0/build/src" --logbufsecs="0" --logging_level="INFO" --mapped_directory="/mnt/mesos/sandbox" --quiet="false" --sandbox_directory="/var/lib/mesos/data/slaves/c8bd5b26-6e71-4e18-b490-821dbf7edd9d-S0/frameworks/6079a596-90a8-4fa5-9c92-9215558737d1-0000/executors/jenkins-t7.9be44260-f99c-11e5-b0ac-e4115bb26fcc/runs/ac0b4dbb-10e4-4684-a4df-9539258d77ee" --stop_timeout="0ns"
Registered docker executor on slave4
Starting task jenkins-t7.9be44260-f99c-11e5-b0ac-e4115bb26fcc
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?

stderr 显示

I0403 14:04:51.026866  6569 exec.cpp:143] Version: 0.28.0
I0403 14:04:51.032097  6585 exec.cpp:217] Executor registered on slave c8bd5b26-6e71-4e18-b490-821dbf7edd9d-S0
WARNING: Your kernel does not support swap limit capabilities, memory limited without swap.
touch: cannot touch ‘/var/jenkins_home/copy_reference_file.log’: Permission denied

我正在使用

马拉松 1.0.0 RC1 金币 0.28.0

码头工人 1.10.3

操作系统是 ubuntu 14.04.4 LTS

有没有人指出我哪里出错了?我的感觉是,问题在于持久卷及其到詹金斯容器的映射。

【问题讨论】:

  • 代理的/var/jenkins_home文件夹有什么权限?
  • 我刚刚更正了 host_path 中的一个错误。它是 jenkins_path,但应该说 jenkins_home。我已经进行了更正。但是,两个容器路径引用不匹配。回家后我会修改它们,以便它们匹配。

标签: jenkins docker mesos marathon


【解决方案1】:

我让它工作了。 git clone https://github.com/jenkinsci/docker.git 到你的代理节点。我的全部都做到了

在 Dockerfile 的第 16 行和第 17 行前面插入 #,例如

#    RUN groupadd -g ${gid} ${group} \
#        && useradd -d "$JENKINS_HOME" -u ${uid} -g ${gid} -m -s /bin/bash ${user}

运行sudo docker build . 使用 sudo docker tag xyz jenkins 将 repo 重命名为 jenkins,然后使用 docker、jenkins 和持久卷创建应用程序。

【讨论】:

  • 你能帮忙看看你使用的最新的 JSON 吗?
  • 只删除容器中的用户,导致镜像构建失败
  • 我不确定你所说的失败是什么意思。图像已经建立并且可以工作。我确实意识到 jenkins 以 root 身份运行,上面的语句被注释掉了。默认情况下,持久卷具有 root 权限,因此 jenkins 容器中的任何其他用户都不起作用。 @pravin 看看马拉松谷歌组
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-01-07
  • 2017-10-19
  • 2016-10-15
  • 1970-01-01
  • 2017-02-10
  • 2019-01-14
相关资源
最近更新 更多