简体   繁体   English

如何在Windows Docker容器中运行Jenkins作业

[英]How to run a Jenkins job inside a windows docker container

I am trying to run a jenkins job inside a windows docker container. 我正在尝试在Windows Docker容器中运行jenkins作业。 I have successfully created an image with windows server code docker image which will have MSBuildEngine 4.7. 我已经使用Windows Server代码docker image成功创建了一个映像,该映像将具有MSBuildEngine 4.7。

The problem I am facing is I am not able to run a Jenkins job inside that container. 我面临的问题是我无法在该容器中运行Jenkins作业。

I am able to do it easily with linux environment. 我可以在linux环境下轻松地做到这一点。

The actual problem is, Jenkins first puts a shell file which will have the command to run the container and inspect it. 实际的问题是,Jenkins首先放置了一个外壳文件,该文件将具有运行容器并对其进行检查的命令。

How do I tell Jenkins that my environment is not Linux and it is Windows. 我如何告诉詹金斯,我的环境不是Linux,而是Windows。

Note: Searching in google does not help now a days. 注意:现在在Google中搜索无济于事。 So I directly reached out here 所以我直接伸出手来

I am working on this issue as well. 我也在这个问题上工作。 I am finding that the (maybe just a) underlying issue is how Jenkins tells Docker to mount a volume to the container. 我发现,(也许仅仅是一个)潜在的问题是詹金斯如何告诉Docker将卷安装到容器上。 I have yet to get around this issue. 我还没有解决这个问题。

edit: 编辑:

There's a PR addressing this issue and I tested the fork with both Linux and Windows slaves to work as we intend. 有一个PR解决了这个问题,我测试了Linux和Windows从属服务器的分叉是否可以正常工作。

  1. Download Rbutcher's fork of the plugin: 下载Rbutcher的插件分支:
    • git clone https://github.com/rbutcher/docker-workflow-plugin.git
  2. Change to the working branch: 转到工作分支:
    • git checkout feat/windows_slaves
  3. Build the plugin: 构建插件:
    • mvn -DskipTests clean install
  4. Manually import into Jenkins: 手动导入Jenkins:
    • Manage Jenkins> Manage Plugins> Advanced>Upload Plugin and select ./target/docker-workflow.hpi . 管理Jenkins>管理插件>高级>上传插件,然后选择./target/docker-workflow.hpi

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

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