通过 docker compose 部署时 GitLab CI 管道失败

GitLab CI pipeline failing when deploying via docker compose

我有一个本地托管的 GitLab CI 设置,我正在 运行 通过 Docker Compose。我正在尝试通过管道推送一个基本应用程序,但在 运行ner 中不断出现以下错误。我的 gitlab-ci.yml 文件在一个带有 Kotlin 项目的仓库中。当我 运行 相同的 gitlab-ci.yml 文件在一个空白的 repo 中(即,没有 Kotlin 项目,只有 gitlab-ci.yml 文件)它工作。知道为什么我会收到此错误并且管道失败吗?

GitLab CI 文件

image: alpine

stages:
  - build
  - test

build:
  stage: build
  script:
    - mkdir build
    - touch build/info.txt
  artifacts:
    paths:
      - ./build/libs/

test:
  stage: test
  script:
    - echo "Testing"
    - test -f "build/info.txt"

Docker 撰写文件

version: "3.7"
services:
  web:
    image: 'gitlab/gitlab-ce:latest'
    restart: always
    hostname: 'XXX'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'https://XXX'
    ports:
      - '80:80'
      - '443:443'
      - '223:22'
    volumes:
      - '/Users/XXX/dockvol/srv/gitlab/config:/etc/gitlab'
      - '/Users/XXX/dockvol/srv/gitlab/logs:/var/log/gitlab'
      - '/Users/XXX/dockvol/srv/gitlab/data:/var/opt/gitlab'
  runner:
    image: 'gitlab/gitlab-runner:latest'
    restart: always
    user: root
    privileged: true
    volumes:
      - '/Users/XXX/dockvol/srv/gitlab-runner/config:/etc/gitlab-runner'
      - '/var/run/docker.sock:/var/run/docker.sock'

GitLab 运行器日志

[0KRunning with gitlab-runner 12.10.1 (ce065b93)
[0;m[0K  on first u7d9d-Gt
[0;msection_start:1589194575:prepare_executor
[0K[0K[36;1mPreparing the "docker" executor[0;m
[0;m[0KUsing Docker executor with image registry.gitlab.com/gitlab-org/cluster-integration/auto-build-image:v0.2.2 ...
[0;m[0KStarting service docker:19.03.8-dind ...
[0;m[0KPulling docker image docker:19.03.8-dind ...
[0;m[0KUsing docker image sha256:c814ba3a41a3de0a9a23b7d0bb36f64257b12aef5103b4ce1d5f1bfc3033aad3 for docker:19.03.8-dind ...
[0;m[0KWaiting for services to be up and running...
[0;m
[0;33m*** WARNING:[0;m Service runner-u7d9d-gt-project-2-concurrent-0-2742755dfb40c120-docker-0 probably didn't start properly.

Health check error:
service "runner-u7d9d-gt-project-2-concurrent-0-2742755dfb40c120-docker-0-wait-for-service" timeout

Health check container logs:


Service container logs:
2020-05-11T10:56:16.757478300Z time="2020-05-11T10:56:16.753561500Z" level=info msg="Starting up"
2020-05-11T10:56:16.757519200Z time="2020-05-11T10:56:16.754810900Z" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
2020-05-11T10:56:16.757539400Z time="2020-05-11T10:56:16.754999600Z" level=warning msg="[!] DON'T BIND ON ANY IP ADDRESS WITHOUT setting --tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING [!]"
2020-05-11T10:56:16.759713500Z time="2020-05-11T10:56:16.759610700Z" level=info msg="libcontainerd: started new containerd process" pid=24
2020-05-11T10:56:16.759987700Z time="2020-05-11T10:56:16.759877800Z" level=info msg="parsed scheme: \"unix\"" module=grpc
2020-05-11T10:56:16.760232100Z time="2020-05-11T10:56:16.760052300Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
2020-05-11T10:56:16.760440300Z time="2020-05-11T10:56:16.760323100Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
2020-05-11T10:56:16.760697900Z time="2020-05-11T10:56:16.760562700Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
2020-05-11T10:56:16.802604300Z time="2020-05-11T10:56:16.802375600Z" level=info msg="starting containerd" revision=7ad184331fa3e55e52b890ea95e65ba581ae3429 version=v1.2.13 
2020-05-11T10:56:16.802887300Z time="2020-05-11T10:56:16.802666400Z" level=info msg="loading plugin "io.containerd.content.v1.content"..." type=io.containerd.content.v1 
2020-05-11T10:56:16.802911600Z time="2020-05-11T10:56:16.802756700Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.btrfs"..." type=io.containerd.snapshotter.v1 
2020-05-11T10:56:16.803104600Z time="2020-05-11T10:56:16.802954000Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.btrfs" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" 
2020-05-11T10:56:16.803127900Z time="2020-05-11T10:56:16.802996000Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.aufs"..." type=io.containerd.snapshotter.v1 
2020-05-11T10:56:16.808895200Z time="2020-05-11T10:56:16.808690300Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.aufs" error="modprobe aufs failed: "ip: can't find device 'aufs'\nmodprobe: can't change directory to '/lib/modules': No such file or directory\n": exit status 1" 
2020-05-11T10:56:16.808920800Z time="2020-05-11T10:56:16.808735700Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.native"..." type=io.containerd.snapshotter.v1 
2020-05-11T10:56:16.808938400Z time="2020-05-11T10:56:16.808831800Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.overlayfs"..." type=io.containerd.snapshotter.v1 
2020-05-11T10:56:16.809111500Z time="2020-05-11T10:56:16.808985800Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.zfs"..." type=io.containerd.snapshotter.v1 
2020-05-11T10:56:16.809360200Z time="2020-05-11T10:56:16.809185500Z" level=info msg="skip loading plugin "io.containerd.snapshotter.v1.zfs"..." type=io.containerd.snapshotter.v1 
2020-05-11T10:56:16.809517400Z time="2020-05-11T10:56:16.809286000Z" level=info msg="loading plugin "io.containerd.metadata.v1.bolt"..." type=io.containerd.metadata.v1 
2020-05-11T10:56:16.809541700Z time="2020-05-11T10:56:16.809360200Z" level=warning msg="could not use snapshotter zfs in metadata plugin" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter: skip plugin" 
2020-05-11T10:56:16.809561500Z time="2020-05-11T10:56:16.809381000Z" level=warning msg="could not use snapshotter btrfs in metadata plugin" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" 
2020-05-11T10:56:16.809576500Z time="2020-05-11T10:56:16.809405200Z" level=warning msg="could not use snapshotter aufs in metadata plugin" error="modprobe aufs failed: "ip: can't find device 'aufs'\nmodprobe: can't change directory to '/lib/modules': No such file or directory\n": exit status 1" 
2020-05-11T10:56:16.815691100Z time="2020-05-11T10:56:16.815570700Z" level=info msg="loading plugin "io.containerd.differ.v1.walking"..." type=io.containerd.differ.v1 
2020-05-11T10:56:16.815717500Z time="2020-05-11T10:56:16.815635400Z" level=info msg="loading plugin "io.containerd.gc.v1.scheduler"..." type=io.containerd.gc.v1 
2020-05-11T10:56:16.815792400Z time="2020-05-11T10:56:16.815691100Z" level=info msg="loading plugin "io.containerd.service.v1.containers-service"..." type=io.containerd.service.v1 
2020-05-11T10:56:16.815812800Z time="2020-05-11T10:56:16.815711600Z" level=info msg="loading plugin "io.containerd.service.v1.content-service"..." type=io.containerd.service.v1 
2020-05-11T10:56:16.815832200Z time="2020-05-11T10:56:16.815731400Z" level=info msg="loading plugin "io.containerd.service.v1.diff-service"..." type=io.containerd.service.v1 
2020-05-11T10:56:16.815959900Z time="2020-05-11T10:56:16.815758300Z" level=info msg="loading plugin "io.containerd.service.v1.images-service"..." type=io.containerd.service.v1 
2020-05-11T10:56:16.815979600Z time="2020-05-11T10:56:16.815786300Z" level=info msg="loading plugin "io.containerd.service.v1.leases-service"..." type=io.containerd.service.v1 
2020-05-11T10:56:16.816031600Z time="2020-05-11T10:56:16.815812800Z" level=info msg="loading plugin "io.containerd.service.v1.namespaces-service"..." type=io.containerd.service.v1 
2020-05-11T10:56:16.816050500Z time="2020-05-11T10:56:16.815832200Z" level=info msg="loading plugin "io.containerd.service.v1.snapshots-service"..." type=io.containerd.service.v1 
2020-05-11T10:56:16.816069200Z time="2020-05-11T10:56:16.815852500Z" level=info msg="loading plugin "io.containerd.runtime.v1.linux"..." type=io.containerd.runtime.v1 
2020-05-11T10:56:16.816256700Z time="2020-05-11T10:56:16.816012200Z" level=info msg="loading plugin "io.containerd.runtime.v2.task"..." type=io.containerd.runtime.v2 
2020-05-11T10:56:16.816295100Z time="2020-05-11T10:56:16.816107400Z" level=info msg="loading plugin "io.containerd.monitor.v1.cgroups"..." type=io.containerd.monitor.v1 
2020-05-11T10:56:16.816670700Z time="2020-05-11T10:56:16.816517200Z" level=info msg="loading plugin "io.containerd.service.v1.tasks-service"..." type=io.containerd.service.v1 
2020-05-11T10:56:16.816689200Z time="2020-05-11T10:56:16.816565100Z" level=info msg="loading plugin "io.containerd.internal.v1.restart"..." type=io.containerd.internal.v1 
2020-05-11T10:56:16.816905500Z time="2020-05-11T10:56:16.816601200Z" level=info msg="loading plugin "io.containerd.grpc.v1.containers"..." type=io.containerd.grpc.v1 
2020-05-11T10:56:16.816927300Z time="2020-05-11T10:56:16.816644400Z" level=info msg="loading plugin "io.containerd.grpc.v1.content"..." type=io.containerd.grpc.v1 
2020-05-11T10:56:16.816946500Z time="2020-05-11T10:56:16.816664600Z" level=info msg="loading plugin "io.containerd.grpc.v1.diff"..." type=io.containerd.grpc.v1 
2020-05-11T10:56:16.816970000Z time="2020-05-11T10:56:16.816683100Z" level=info msg="loading plugin "io.containerd.grpc.v1.events"..." type=io.containerd.grpc.v1 
2020-05-11T10:56:16.816988200Z time="2020-05-11T10:56:16.816706000Z" level=info msg="loading plugin "io.containerd.grpc.v1.healthcheck"..." type=io.containerd.grpc.v1 
2020-05-11T10:56:16.817007500Z time="2020-05-11T10:56:16.816725600Z" level=info msg="loading plugin "io.containerd.grpc.v1.images"..." type=io.containerd.grpc.v1 
2020-05-11T10:56:16.817027300Z time="2020-05-11T10:56:16.816748100Z" level=info msg="loading plugin "io.containerd.grpc.v1.leases"..." type=io.containerd.grpc.v1 
2020-05-11T10:56:16.817051600Z time="2020-05-11T10:56:16.816770600Z" level=info msg="loading plugin "io.containerd.grpc.v1.namespaces"..." type=io.containerd.grpc.v1 
2020-05-11T10:56:16.817069300Z time="2020-05-11T10:56:16.816826200Z" level=info msg="loading plugin "io.containerd.internal.v1.opt"..." type=io.containerd.internal.v1 
2020-05-11T10:56:16.817164600Z time="2020-05-11T10:56:16.817013400Z" level=info msg="loading plugin "io.containerd.grpc.v1.snapshots"..." type=io.containerd.grpc.v1 
2020-05-11T10:56:16.817184800Z time="2020-05-11T10:56:16.817051600Z" level=info msg="loading plugin "io.containerd.grpc.v1.tasks"..." type=io.containerd.grpc.v1 
2020-05-11T10:56:16.817204200Z time="2020-05-11T10:56:16.817069300Z" level=info msg="loading plugin "io.containerd.grpc.v1.version"..." type=io.containerd.grpc.v1 
2020-05-11T10:56:16.817512500Z time="2020-05-11T10:56:16.817088000Z" level=info msg="loading plugin "io.containerd.grpc.v1.introspection"..." type=io.containerd.grpc.v1 
2020-05-11T10:56:16.817535100Z time="2020-05-11T10:56:16.817246500Z" level=info msg=serving... address="/var/run/docker/containerd/containerd-debug.sock" 
2020-05-11T10:56:16.817554300Z time="2020-05-11T10:56:16.817388600Z" level=info msg=serving... address="/var/run/docker/containerd/containerd.sock" 
2020-05-11T10:56:16.817887700Z time="2020-05-11T10:56:16.817745100Z" level=info msg="containerd successfully booted in 0.015996s" 
2020-05-11T10:56:16.832721600Z time="2020-05-11T10:56:16.831736800Z" level=info msg="Setting the storage driver from the $DOCKER_DRIVER environment variable (overlay2)"
2020-05-11T10:56:16.832749800Z time="2020-05-11T10:56:16.831998200Z" level=info msg="parsed scheme: \"unix\"" module=grpc
2020-05-11T10:56:16.832767100Z time="2020-05-11T10:56:16.832027100Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
2020-05-11T10:56:16.832787000Z time="2020-05-11T10:56:16.832051500Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
2020-05-11T10:56:16.832814000Z time="2020-05-11T10:56:16.832071300Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
2020-05-11T10:56:16.835365700Z time="2020-05-11T10:56:16.834371800Z" level=info msg="parsed scheme: \"unix\"" module=grpc
2020-05-11T10:56:16.835384000Z time="2020-05-11T10:56:16.834434500Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
2020-05-11T10:56:16.835404400Z time="2020-05-11T10:56:16.834464500Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
2020-05-11T10:56:16.835460300Z time="2020-05-11T10:56:16.834487500Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
2020-05-11T10:56:16.872802700Z time="2020-05-11T10:56:16.870967500Z" level=info msg="Loading containers: start."
2020-05-11T10:56:16.892366800Z time="2020-05-11T10:56:16.891473000Z" level=warning msg="Running modprobe bridge br_netfilter failed with message: ip: can't find device 'bridge'\nip: can't find device 'br_netfilter'\nmodprobe: can't change directory to '/lib/modules': No such file or directory\n, error: exit status 1"
2020-05-11T10:56:17.032576600Z time="2020-05-11T10:56:17.032377200Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.18.0.0/16. Daemon option --bip can be used to set a preferred IP address"
2020-05-11T10:56:17.091567300Z time="2020-05-11T10:56:17.091375400Z" level=info msg="Loading containers: done."
2020-05-11T10:56:17.113255800Z time="2020-05-11T10:56:17.113013400Z" level=info msg="Docker daemon" commit=afacb8b7f0 graphdriver(s)=overlay2 version=19.03.8
2020-05-11T10:56:17.113701300Z time="2020-05-11T10:56:17.113556300Z" level=info msg="Daemon has completed initialization"
2020-05-11T10:56:17.179131600Z time="2020-05-11T10:56:17.178944800Z" level=info msg="API listen on [::]:2375"
2020-05-11T10:56:17.179529600Z time="2020-05-11T10:56:17.179155300Z" level=info msg="API listen on /var/run/docker.sock"

[0;33m*********[0;m

[0KPulling docker image registry.gitlab.com/gitlab-org/cluster-integration/auto-build-image:v0.2.2 ...
[0;m[0KUsing docker image sha256:a9a470e7a925ecfd27cfbb60e98c0915f02a3eb8a81f15fb6b11af1baca21e63 for registry.gitlab.com/gitlab-org/cluster-integration/auto-build-image:v0.2.2 ...
[0;msection_end:1589194608:prepare_executor
[0Ksection_start:1589194608:prepare_script
[0K[0K[36;1mPreparing environment[0;m
[0;mRunning on runner-u7d9d-gt-project-2-concurrent-0 via 242fc900f561...
section_end:1589194609:prepare_script
[0Ksection_start:1589194609:get_sources
[0K[0K[36;1mGetting source from Git repository[0;m
[0;m[32;1mFetching changes with git depth set to 50...[0;m
Reinitialized existing Git repository in /builds/XXX/starter-project-kotlin/.git/
From http://XXX/XXX/starter-project-kotlin
 * [new ref]         refs/pipelines/9 -> refs/pipelines/9
   fa35e89..260c063  master           -> origin/master
[32;1mChecking out 260c0632 as master...[0;m
Removing Dockerfile

[32;1mSkipping Git submodules setup[0;m
section_end:1589194611:get_sources
[0Ksection_start:1589194611:restore_cache
[0K[0K[36;1mRestoring cache[0;m
[0;msection_end:1589194612:restore_cache
[0Ksection_start:1589194612:download_artifacts
[0K[0K[36;1mDownloading artifacts[0;m
[0;msection_end:1589194613:download_artifacts
[0Ksection_start:1589194613:build_script
[0K[0K[36;1mRunning before_script and script[0;m
[0;m[32;1m$ if [[ -z "$CI_COMMIT_TAG" ]]; then # collapsed multi-line command[0;m
[32;1m$ /build/build.sh[0;m
Building Heroku-based application using gliderlabs/herokuish docker image...
invalid reference format
invalid reference format
invalid argument "/master:260c0632aca32f789a54acdb976cde17e0113f62" for "-t, --tag" flag: invalid reference format
See 'docker build --help'.
section_end:1589194615:build_script
[0Ksection_start:1589194615:after_script
[0K[0K[36;1mRunning after_script[0;m
[0;msection_end:1589194616:after_script
[0Ksection_start:1589194616:upload_artifacts_on_failure
[0K[0K[36;1mUploading artifacts for failed job[0;m
[0;msection_end:1589194617:upload_artifacts_on_failure
[0K[31;1mERROR: Job failed: exit code 1
[0;m

似乎构建标签 "/master:260c0632aca32f789a54acdb976cde17e0113f62" 的 Docker 格式错误。

A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. A tag name may not start with a period or a dash and may contain a maximum of 128 characters. Ref.

GitLab CI 上的 "$CI_COMMIT_TAG" ENV 内容是否相同?该构建脚本 build.sh.

存在一些问题

一些相关问题:

https://gitlab.com/gitlab-org/gitlab-foss/-/issues/64530

而问题可能解决为:

If anyone is having this issue in combination with Heroku-based applications (e.g. in Gitlab AutoDevOps) you might need to activate the GitLab container registry on your GitLab installation and in your project.