简体   繁体   English

Docker - Jenkins - Jenkins 中的本地系统文件/文件夹访问和执行

[英]Docker - Jenkins - Local System Files/Folders Access and Execution in Jenkins

How to access and execute local system folders/files in jenkins when jenkins image is installed in docker desktop container?当jenkins镜像安装在docker桌面容器中时,如何访问和执行jenkins中的本地系统文件夹/文件?

Please help me to find a way by which we can access and execute local files/folders, inside jenkins image available in docker desktop container?请帮我找到一种方法,我们可以通过它访问和执行本地文件/文件夹,在 docker 桌面容器中可用的 jenkins 图像内?

For example: How to access and run cypress project with jenkins, when the cypress project is available in our local system: For this I've tried by providing custom workspace directory path but also I am getting below errors and not able to run it via jenkins.例如:当 cypress 项目在我们的本地系统中可用时,如何使用 jenkins 访问和运行 cypress 项目:为此,我尝试提供自定义工作区目录路径,但我也遇到以下错误,无法通过以下方式运行它jenkins。

  • I've also observed that while providing path to custom workspace directory If I use 'Users/...' (ie not used forward slash at starting) then I am getting below error:我还观察到,在提供自定义工作区目录的路径时,如果我使用“用户/...”(即在开始时未使用正斜杠),则会出现以下错误:

SC Ref. SC 参考。 1: Custom Workspace path without forward slash at starting 1:开始时没有正斜杠的自定义工作区路径

Console output error for Custom Workspace path without forward slash at starting )开始时没有正斜杠的自定义工作区路径的控制台 output 错误

  • But while providing path to custom workspace directory If I use '/Users/...' (ie used forward slash at starting) then I am getting below error:但是,在提供自定义工作区目录的路径时,如果我使用“/Users/...”(即在开始时使用正斜杠),则会出现以下错误:

SC Ref. SC 参考。 2: Custom Workspace path with forward slash at starting 2:开始时带有正斜杠的自定义工作区路径

Console output error for Custom Workspace path with forward slash at starting开始时带有正斜杠的自定义工作区路径的控制台 output 错误

For ref.: Installed jenkins image container details: Installed jenkins image container details供参考:已安装 jenkins 图像容器详细信息:已安装 jenkins 图像容器详细信息

Thanks for your help in advance!提前感谢您的帮助!

You can use volumes to share files between the image and your host SO, even in windows .您可以使用在映像和主机 SO 之间共享文件, 即使在 windows 中也是如此 You can do it using command line ( -v or --mount command line argument) or using the docker UI.您可以使用命令行( -v--mount命令行参数)或使用 docker UI 来执行此操作。

docker run -v /local/path/:/container/path...

But i'm not really sure that you can run commands inside the volume, i guess that if binaries are compatible, it should work但我不太确定你是否可以在卷内运行命令,我想如果二进制文件兼容,它应该可以工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM