且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法在Docker的Docker映像中连接到守护程序Docker

更新时间:2022-11-30 08:02:40

您需要添加

services:
  - docker:dind

到您的 .gitlab-ci.yml 。这告诉跑步者启动第二个容器(docker:dind),这是一个正在运行的Docker守护程序的映像。它必须在第二个映像中才能运行。

to your .gitlab-ci.yml. This tells the runner to start a second container (docker:dind), which is an image of a working docker daemon. It needs to be in a second image in order to run.

有关更多信息,请参见docker示例项目: https://gitlab.com/gitlab-examples/docker/blob/master/.gitlab-ci.yml

For more Information, see the docker example project: https://gitlab.com/gitlab-examples/docker/blob/master/.gitlab-ci.yml

没有服务就无法工作,因为没有正在运行的docker daemon,并且您无法在 docker内部运行您的构建: dind 容器,因为运行命令将替换docker守护进程。

It doesn't work without the service because there is no running docker daemon and you can't run your build inside the docker:dind container because the run command would replace the docker daemon.