【问题标题】:What are services in gitlab pipeline job?gitlab管道作业中的服务是什么?
【发布时间】:2018-03-17 00:13:23
【问题描述】:

我正在使用 gitlab 的 CI 和 CD 管道为我的项目构建映像。
在每项工作中,都需要设置像 image 和 stage 这样的配置,但我无法理解 services 是什么。有人可以解释它的功能吗?谢谢
这是我找到的代码 sn-p

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

【问题讨论】:

    标签: gitlab pipeline gitlab-ci gitlab-ci-runner


    【解决方案1】:

    The documentation says:

    services 关键字定义了另一个 Docker 映像,该映像在您的作业期间运行并链接到 image 关键字定义的 Docker 映像。这允许您在构建期间访问服务映像。

    【讨论】:

      猜你喜欢
      • 2022-01-16
      • 2021-03-27
      • 2022-06-11
      • 2020-08-18
      • 1970-01-01
      • 2022-01-19
      • 2021-12-23
      • 2023-01-29
      • 2022-01-20
      相关资源
      最近更新 更多