在Jenkins中,我决定使用远程docker功能。
因此,我在Linux服务器上安装了docker.io
,并使用了该管道。
node {
stage('Example') {
docker.withServer('tcp://docker.example.org:2375') {
docker.image('stefanscherer/node-windows:10').inside {
sh 'node --version'
}
}
}
}
但这失败,并显示有关卷配置的错误消息。
java.io.IOException: Failed to run image 'stefanscherer/node-windows:10'. Error: docker: Error response from daemon: invalid volume specification: '/var/lib/jenkins/workspace/Docker Test:/var/lib/jenkins/workspace/Docker Test:rw,z'.
See 'docker run --help'.
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.run(DockerClient.java:133)
也许是我尝试将Linux Jenkins与Docker Windows结合使用?
但是我读到这个是experimental
选项,应该允许使用Linux容器。
通过本指南安装的GitLab-Runner。 https://docs.gitlab.com/runner/install/windows.html
然后,我将其连接并选择docker
作为执行程序。
当我从hosts
中删除daemon.json
时,收到此错误消息。
ERROR: Preparation failed: Error response from daemon: client version 1.18 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version (executor_docker.go:1161:0s)
如何获取支持较新API的版本? 我读了一篇有关GitLab正在等待LTS EOL(生命周期终止)的文章。我认为是CentOS或其他。
在hosts
中设置了daemon.json
后,我收到此错误消息。
ERROR: Preparation failed: error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.18/info: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running. (executor_docker.go:1161:0s)
那是因为跑步者找不到Docker,因为Docker仅在TCP端口上侦听。
我尝试将//./pipe/docker_engine
添加到hosts
的{{1}}中,但是没有用。泊坞窗服务立即崩溃。
Windows Server 2016
daemon.json
daemon.json
我的目标是从(windows)Docker上的(linux)Jenkins和(linux)GitLab构建我的工作。
Jenkins 通常无法正常工作,原因可能是某些设置,或者是因为它试图安装Windows路径?
GitLab 正在使用docker不提供的旧API。
答案 0 :(得分:1)
您处在正确的轨道上,分发CI管道可以轻松扩展,而容器是实现此目标的理想解决方案。
在Docker Pipeline Jenkins documentation中进行了解释:
要使inside()正常工作,Docker服务器和Jenkins代理必须使用 相同的文件系统,以便可以安装工作区。
因此,请尝试使用其他命令(例如withRun),无论如何我都会在这里错过一些凭据。您还可以为Docker配置一个新的Jenkins节点,并在那里指定执行作业的路径。
如here所述,Windows 1上的GitLab运行程序问题计划包含在11.8版本(2019年2月)中。
如果您不能等到新的GitLab版本发布,我将进行Linux安装,并且我将为here中所述的docker配置添加一个新的Jenkins节点。