Error in gitlab CI/CD while docker login invalid certificate.

huangapple go评论54阅读模式
英文:

Error in gitlab CI/CD while docker login invalid certificate

问题

以下是您提供的内容的翻译:

在Docker中运行的GitLab和GitLab Runner中,我已经设置了一个正常工作的容器注册表。

当我在CI/CD中尝试执行以下操作时,我遇到了错误:

stages:          # 作业阶段的列表,以及它们的执行顺序
  - build

docker-build:
  # 使用官方的Docker镜像。
  image: docker:latest
  services:
   - docker:dind
  stage: build
  script:
    - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin

我遇到了以下错误:

Get "https://git.domain.com:5050/v2/": x509: 由未知授权签发的证书

我的Runner配置文件config.toml如下:

concurrent = 1
check_interval = 0
shutdown_timeout = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "Runner"
  url = "http://git.domain.com/"
  id = 3
  token = "xxxxxxxxxcccccc"
  token_obtained_at = 2023-02-07T22:14:54Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "docker"
  clone_url = "http://git.domain.com/"
  [runners.custom_build_dir]
  [runners.cache]
    MaxUploadedArchiveSize = 0
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "node:latest"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0

对此我该怎么办?

当我从我的个人电脑上执行登录操作时,一切正常。

编辑:
我的证书不是自签名的。

英文:

Hey i got GitLab and gitlab runner runned in docker in gitlab i got working container registry.
when in CI/CD im trying to do

stages:          # List of stages for jobs, and their order of execution
  - build

docker-build:
  # Use the official docker image.
  image: docker:latest
  services:
   - docker:dind
  stage: build
  script:
    - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin

I got error like
Get "https://git.domain.com:5050/v2/": x509: certificate signed by unknown authority

my runner config.toml looks like this

concurrent = 1
check_interval = 0
shutdown_timeout = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "Runner"
  url = "http://git.domain.com/"
  id = 3
  token = "xxxxxxxxxcccccc"
  token_obtained_at = 2023-02-07T22:14:54Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "docker"
  clone_url = "http://git.domain.com/"
  [runners.custom_build_dir]
  [runners.cache]
    MaxUploadedArchiveSize = 0
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "node:latest"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0

What can i do with this?

When i do login from my pc its works perfect

edit:
My cert is not selfsigned

答案1

得分: 1

我将我的CA证书添加到证书中,现在它可以工作。

英文:

I added my CA certificate to certificate, and now its works

huangapple
  • 本文由 发表于 2023年2月8日 14:59:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/75382319.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定