【发布时间】:2018-06-20 22:24:56
【问题描述】:
所以我正在使用一个稍微奇怪的基础架构:我有一个 openshift 容器平台,它使用图像 openshift3/jenkins-2-rhel7 在其中运行来自 docker 的 jenkins 图像
我正在尝试运行 docker build 。命令在 jenkins 管道中,我收到“无法连接到 Docker 守护程序”错误。我不明白为什么 docker 安装在机器上但没有运行,而且我目前无法访问除 cli 和控制台之外的 openshift 服务器。有没有人有关于如何获得 docker build 的建议。使用或不使用 slaves 的 jenkins 命令是否成功运行?
node("master"){
withEnv(["PATH=${tool 'docker'}/bin:${env.PATH}"]) {
docker.withRegistry( 'dockertest') {
git url: "https://github.com/mydockertag/example.git", credentialsId: 'dockertest'
stage "build"
sh "docker build -t mydockertag/example -f ./Dockerfile ."
stage "publish"
}
}
运行构建命令后出现以下错误:
+ docker build -t mydockertag/example -f ./Dockerfile .
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the
docker daemon running?
【问题讨论】:
-
我相信您通常会在 OpenShift 中为 docker 构建设置单独的构建配置,并从 Jenkins 中的作业触发该单独构建。您可以在docs.openshift.com/container-platform/3.9/dev_guide/…docs.openshift.com/container-platform/3.9/dev_guide/… 上搜索有关在 OpenShift 中使用管道的文档搜索更多详细信息
标签: docker jenkins openshift jenkins-plugins docker-swarm