詹金斯错误的卷权限 [英] Jenkins wrong volume permissions

查看:138
本文介绍了詹金斯错误的卷权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个托管Oracle Linux的虚拟机,我在其中安装了Docker并使用docker-compose文件创建了容器.我将jenkins卷放在一个共享文件夹下,但是在启动docker-compose时,我遇到了Jenkins的以下错误:

I have a virtual machine hosting Oracle Linux where I've installed Docker and created containers using a docker-compose file. I placed the jenkins volume under a shared folder but when starting the docker-compose up I got the following error for Jenkins :

詹金斯| touch:无法触摸"/var/jenkins_home/copy_reference_file.log":权限被拒绝 詹金斯|无法写入/var/jenkins_home/copy_reference_file.log.错误的卷权限? 詹金斯(Jenkins)以代码1退出

jenkins | touch: cannot touch ‘/var/jenkins_home/copy_reference_file.log’: Permission denied jenkins | Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions? jenkins exited with code 1

这是卷的声明

  volumes:
    - "/media/sf_devops-workspaces/dev-tools/continuous-integration/jenkins:/var/jenkins_home"

推荐答案

问题是,您容器中的用户与主机上的用户具有不同的userid:groupid.

The problem is, that your user in the container has different userid:groupid as the user on the host.

您有两种可能性:

  1. 您可以确保容器中的用户具有与主机上的用户相同的userid:groupid,该主机可以访问装入的卷.为此,您必须在Dockerfile中调整用户.在具有相同userid:groupid的dockerfile中创建一个用户,然后切换到该用户 https: //docs.docker.com/engine/reference/builder/#user

您可以确保主机上的用户与容器中的用户具有相同的userid:groupid.为此,请输入带有docker exec -it <container-name> bash的容器,并显示用户ID id -u <username>组ID id -G <username>.将已安装的卷的权限更改为此userid:groupid.

You can ensure that the user on the host has the same userid:groupid like the user in the container. For this, enter the container with docker exec -it <container-name> bash and show the user id id -u <username> group id id -G <username>. Change the permissions of the mounted volume to this userid:groupid.

这篇关于詹金斯错误的卷权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆