在我的 kubernetes 集群中,有一个为 CI/CD 管道注册的 GitLab Runner,它具有构建特定 docker 映像的阶段。管道如下所示:
stages:
- build web-app
- build image
compile web-app:
stage: build web-app
image: node:12-alpine
before_script:
- npm ci --cache .npm --prefer-offline
script:
- npm run ng build --prod
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- .npm/
build image:
stage: build image
image: docker:latest
services:
- docker:dind
script:
- export DOCKER_HOST=$DOCKER_PORT
- docker build -t registry/web-app:$CI_PIPELINE_ID .
但我得到了错误:
$ export DOCKER_HOST=$DOCKER_PORT
$ docker build -t registry/web-app:$CI_PIPELINE_ID .
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
我已经尝试了各种方法来解决这个问题,但没有任何效果。任何建议我做错了什么或根本没有?
非常感谢您的建议!