[英]Cannot get Jenkins Docker slave to build docker images
我目前正在與Docker結合Jenkins進行實驗,以簡化新項目的CI / CD工作流程。 我在裝有Docker 1.12的Mac上執行此操作。
這是我的工作:
通過此設置,我運行了一個非常簡單的管道作業,如下所示:
node('docker') {
docker.image('hseeberger/scala-sbt').inside {
stage 'Checkout'
echo 'We got here!'
}
}
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
現在,當我瀏覽解決方案時,通常會提到需要將Docker套接字作為一個卷提供給容器,但這似乎也不起作用。
既然常規設置似乎可以正常工作,那么從站是否就不必像Jenkins插件那樣首先做同樣的事情來啟動Docker從站? 也就是說,使用Docker服務器的URL進行控制嗎? 由於我認為這是一個非常普通的用例,因此必須為Jenkins Docker從屬服務器提供一個Docker映像,可以立即執行此操作,對嗎? 我想念什么?
您可能需要設置docker env並在運行的shellscript中使用docker-machine env node
的內容。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.