gitlab管道工作中的服务是什么?
What are services in gitlab pipeline job?
我正在使用 gitlab 的管道 CI 和 CD 来为我的项目构建图像。
在每项工作中都有要设置的配置,例如 image
和 stage
但我无法理解 services
是什么。有人可以解释它的功能吗?谢谢
这是我使用的代码片段,我发现
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
The services
keyword defines just another Docker image that is run during your job and is linked to the Docker image that the image
keyword defines. This allows you to access the service image during build time.
我正在使用 gitlab 的管道 CI 和 CD 来为我的项目构建图像。
在每项工作中都有要设置的配置,例如 image
和 stage
但我无法理解 services
是什么。有人可以解释它的功能吗?谢谢
这是我使用的代码片段,我发现
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
The
services
keyword defines just another Docker image that is run during your job and is linked to the Docker image that theimage
keyword defines. This allows you to access the service image during build time.