1

尝试使用 gitlab-ci 和 dind 执行作业时,我一直遇到基本的身份验证错误。我似乎无法弄清楚这一点。我可以看到第一次登录工作正常,但是当它尝试进行构建时,它失败了。

具有特权的 Gitlab-Runner

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "stg-runner-1"
  url = "https://private-repo.com/"
  token = "xxxxxxxxxxxxxxxx"
  executor = "docker"
  environment = ["DOCKER_TLS_CERTDIR=", "DOCKER_HOST=tcp://docker:2375/", "DOCKER_DRIVER=overlay2"]
  [runners.custom_build_dir]
  [runners.docker]
    tls_verify = false
    image = "stable-git"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]

.gitlab-ci 稍后在构建完成后调用发布脚本。

image: private-repo:6000/docker/image-docker:latest

services:
  - docker:stable-dind

variables:
  IMAGE_GROUP: docker
  IMAGE_NAME:  sfcc-docker

before_script:
  - chmod +x docker_publish

snapshot:
 except:
  - master
 script:
  - docker images list
  - ./docker_publish -g $IMAGE_GROUP -n $IMAGE_NAME
  - docker images list

release:
 only:
  - /^v\d{1,}[.]\d{1,3}[.]\d{1,3}$/
 script:
  - ./docker_publish -g $IMAGE_GROUP -n $IMAGE_NAME -c $CI_COMMIT_TAG -r

Dockerfile:如果我使用 docker build 工作正常。

#FROM docker:stable  **using this works on build
FROM private-repo:6000/docker:stable  #using this fails

RUN apk update \
    && apk add bash ca-certificates libressl-dev --no-cache \
    &&  rm -rf /var/cache/apk/*

COPY docker_publish /usr/local/bin/

COPY SomeCertStuff.crt /etc/ssl/certs/
COPY SomeCertstuff.crt /etc/ssl/certs/
RUN update-ca-certificates --fresh

这是我在下面遇到的错误。

Skipping Git submodules setup
Authenticating with credentials from $DOCKER_AUTH_CONFIG
$ chmod +x docker_publish
$ docker images list
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
$ ./docker_publish -g $IMAGE_GROUP -n $IMAGE_NAME
g:docker
n:sfcc-docker
Dockerfile not specified. Using "Dockerfile" from script path.
Docker Login Success.
Sending build context to Docker daemon  79.87kB

Step 1/6 : FROM private-repo.com:6000/docker:stable
Get https://private-repo.com:6000/v2/docker/manifests/stable: no basic auth credentials
ERROR: Job failed: exit code 1

任何建议都会很棒。谢谢

4

0 回答 0