我目前正在尝试将Docker与Jenkins结合使用,以简化新项目的CI/CD工作流程.我在安装了Docker 1.12的Mac上这样做.
这就是我做的:
通过这个设置,我运行一个非常简单的管道工作,如下所示:
node('docker') {
docker.image('hseeberger/scala-sbt').inside {
stage 'Checkout'
echo 'We got here!'
}
}
Run Code Online (Sandbox Code Playgroud)
Jenkins按预期旋转Docker实例并执行该作业.所以基本的Docker设置正如预期的那样工作.
但是作业中的Docker命令失败了.日志输出如下所示:
[Pipeline] node
Still waiting to schedule task
Docker-23ebf3d8dd4f is offline
Running on Docker-23ebf3d8dd4f in /home/jenkins/workspace/docker-test
[Pipeline] {
[Pipeline] sh
[docker-test] Running shell script
+ docker inspect -f . hseeberger/scala-sbt
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
[Pipeline] sh
[docker-test] Running shell script
+ docker pull hseeberger/scala-sbt
Using default tag: latest
Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon. Is the docker daemon running on this host?). Using system default: https://index.docker.io/v1/
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Run Code Online (Sandbox Code Playgroud)
现在,当我浏览解决方案时,通常会提到Docker套接字需要作为卷提供给容器,但这似乎也不起作用.
由于一般设置似乎正在起作用,奴隶是不是必须做同样的事情,因为Jenkins插件首先启动Docker奴隶呢?也就是说,使用Docker服务器的URL来控制它?由于我认为这是一个非常常见的用例,Jenkins Docker奴隶必须有一个Docker镜像,可以开箱即用,对吧?我错过了什么?
| 归档时间: |
|
| 查看次数: |
916 次 |
| 最近记录: |