我在 RHEL 8 上运行 Jenkins。我正在尝试运行我的管道,但它不起作用,我认为这可能是 Podman 的问题,因为我能够在使用 docker-ce 的机器上运行管道。
我已经在 /etc/subuid 文件上配置了 jenkins 用户并重新启动。现在我又收到另一个与 docker 相关的错误。
以下是日志:
Checking out Revision 113a2a700837d2de2ed99eabec4ff994b1392a6a (origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 113a2a700837d2de2ed99eabec4ff994b1392a6a # timeout=10
Commit message: "Jenkins"
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] isUnix
[Pipeline] sh
+ docker inspect -f . node:12
.
[Pipeline] withDockerContainer
ERROR: Failed to parse docker version. Please note there is a minimum docker version requirement of v1.7.
Jenkins does not seem to be running inside a container
$ docker run -t -d -u 993:990 -p 3000:3000 -w /var/lib/jenkins/workspace/blade-runner-pipeline -v /var/lib/jenkins/workspace/blade-runner-pipeline:/var/lib/jenkins/workspace/blade-runner-pipeline:rw,z -v /var/lib/jenkins/workspace/blade-runner-pipeline@tmp:/var/lib/jenkins/workspace/blade-runner-pipeline@tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** node:12 cat
$ docker top c35bc763bb7bfedffa2a3629ee8e48132d9175df6e43fea207262c13c1372f3f -eo pid,comm
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.io.IOException: Cannot retrieve .Image from 'docker inspect c35bc763bb7bfedffa2a3629ee8e48132d9175df6e43fea207262c13c1372f3f'
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:225)
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.getContainerRecord(DockerClient.java:352)
at org.jenkinsci.plugins.docker.workflow.WithContainerStep$Execution.start(WithContainerStep.java:209)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:286)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:179)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
和我的 Jenkinsfile
pipeline {
agent {
docker {
image 'node:12'
args '-p 3000:3000'
}
}
stages {
stage('Build') {
steps {
sh 'yarn install'
sh 'yarn test'
sh 'echo " ==== PASSED ===="'
}
}
}
}
答案1
这可能是与 podman 相关的错误,由以下原因引起:https://github.com/containers/libpod/issues/4193。
不太确定哪个 podman 版本可以修复此问题,我猜是 >= 1.6.1。您可以在
podman inspect -f "{{.Image}}" c35bc763bb7bfedffa2a3629ee8e48132d9175df6e43fea207262c13c1372f3f
RHEL 机器上运行来验证此问题以及可能的修复方法。