2017-10-05 89 views
0

我正在使用CI和CD的gitlab管道为我的项目构建图像。
在每一项工作中都有像imagestage这样的配置,但我无法围绕services。有人可以解释它的功能吗?由于
这里有一个代码片段我使用,我发现gitlab管道工作中的服务是什么?

build-run: 
    image: docker:latest 
    stage: build 
    services: 
    - docker:dind 
    script: 
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY 
    - docker build -t "$CI_REGISTRY_IMAGE/my-project:$CI_COMMIT_SHA" . 
    - docker push "$CI_REGISTRY_IMAGE/my-project:$CI_COMMIT_SHA" 
    cache: 
    untracked: true 
    environment: build 

回答

1

The documentation says

services关键字定义只是在你的工作中运行,并链接到多克尔图像的另一码头工人形象的image关键字定义。这使您可以在构建时访问服务映像。