【发布时间】:2017-09-17 23:33:14
【问题描述】:
我有一个运行 gradle 并使用 gradle 插件创建 docker 映像的 jenkins 声明式管道构建。我还使用了一个 dockerfile 代理指令,所以整个事情都在一个 docker 容器中运行。这与安装在 docker 中的 jenkins 本身配合得很好(我知道,这是很多 docker)。我将 jenkins 安装在 docker for mac 上的 docker 容器中,使用 -v /var/run/docker.sock:/var/run/docker.sock (DooD) per https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/。通过此设置,管道 docker 代理运行良好,管道 docker 代理中的 docker build 命令也运行良好。我假设 jenkins 还将 docker 插座安装在其内部 docker 容器上。
现在我正在尝试在安装在正确安装了 docker 的 ec2 实例上的 jenkins 上运行它。 jenkins 用户将 docker 组作为其主要组。 jenkins 用户能够成功运行“docker run hello-world”。我的管道构建启动了 docker 代理容器(基于添加了各种东西的 gradle 映像)但是当 gradle 尝试运行 docker build 命令时,我得到以下信息:
* What went wrong:
Execution failed for task ':docker'.
> Docker execution failed
Command line [docker build -t config-server:latest /var/lib/****/workspace/nfig-server_feature_****-HRUNPR3ZFDVG23XNVY6SFE4P36MRY2PZAHVTIOZE2CO5EVMTGCGA/build/docker] returned:
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
是否可以使用声明性管道在 docker 代理中构建 docker 映像?
【问题讨论】: