首页 > 解决方案 > Docker 无法将文件复制到挂载的卷

问题描述

我无法在 jenkins 上运行此命令,但我可以在 windows powershell 上运行相同的命令

16:13:55  + docker run -v /opt/jenkins/workspace/tas/zigbee-gateway/hostoutput/:/home/jenkins/output_to_host tas-gateway cp -a /home/jenkins/output/. /home/jenkins/output_to_host
16:13:55  cp: cannot create regular file '/home/jenkins/output_to_host/./Gateway_INTL_1.0.4-10_ramips_24kec.ipk': Permission denied
16:13:55  cp: cannot create regular file '/home/jenkins/output_to_host/./Gateway_CN_1.0.4-10_ramips_24kec.ipk': Permission denied
16:13:55  cp: cannot create regular file '/home/jenkins/output_to_host/./Gateway_TEST_1.0.4-10_ramips_24kec.ipk': Permission denied
16:13:55  cp: preserving times for '/home/jenkins/output_to_host/.': Operation not permitted

我错过了什么?jenkins 在亚马逊 linux 上运行

标签: bashdocker

解决方案


看起来 Jenkins 的用户没有对指定文件夹的写入权限。

编辑:请尝试

sudo usermod -aG docker jenkins

推荐阅读