2

我正在尝试使用 docker:dind-rootless 在 GitLab-ci 中构建我的图像。不幸的是它不能正常工作,但是如果我将服务更改为 docker:dind,它工作得很好!?

.dockerization: &dockerization
  before_script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    # - mkdir -p "$MOUNT_POINT"
  image: docker:19.03.12
  script:
    - docker pull $CI_REGISTRY_IMAGE/$IMAGE_NAME:latest || true
    - docker build --cache-from $CI_REGISTRY_IMAGE/$IMAGE_NAME:latest -f $DOCKERFILE --tag $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE/$IMAGE_NAME:latest .
    - docker push $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHA
    - docker push $CI_REGISTRY_IMAGE/$IMAGE_NAME:latest
    # docker run -v "$MOUNT_POINT:/mnt" $IMAGE_NAME /mnt/script/to/run/tests
  services:
    - docker:19.03.12-dind # <= HOW docker:19.03.12-dind-rootless !?
  stage: dockerization
  variables:
    DOCKER_DRIVER: overlay2
    DOCKER_HOST: tcp://localhost:2375
    DOCKER_TLS_CERTDIR: ""
    # MOUNT_POINT: $CI_PROJECT_DIR/mnt
  extends:
    - .default-rule
  when: manual
4

0 回答 0