可以在我的gitlab ci管道中连接到docker守护程序
我正在尝试使用Gitlab CI构建超简单的CI/CD管道。 运行它后,我会出现错误:
Server:
ERROR: Cannot connect to the Docker daemon at tcp://docker:2375.
Is the docker daemon running?
我的.gitlab-ci.yml是:
image: docker:latest
variables:
DOCKER_HOST: tcp://docker:2375
services:
- name: docker:dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
command: ["dockerd-entrypoint.sh"]
before_script:
- docker --version
docker_build:
stage: build
image: docker:latest
services:
- docker:dind
script:
- docker build -t arieltar/hubsec:1.1 .
- docker push arieltar/hubsec:1.1
I am trying to build a super-simple CI/CD pipeline using GitLab CI.
Upon running it I get presented with the error:
Server:
ERROR: Cannot connect to the Docker daemon at tcp://docker:2375.
Is the docker daemon running?
My .gitlab-ci.yml is :
image: docker:latest
variables:
DOCKER_HOST: tcp://docker:2375
services:
- name: docker:dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
command: ["dockerd-entrypoint.sh"]
before_script:
- docker --version
docker_build:
stage: build
image: docker:latest
services:
- docker:dind
script:
- docker build -t arieltar/hubsec:1.1 .
- docker push arieltar/hubsec:1.1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基于我要问的错误消息,
gitlab-runner
用户是否属于docker
组?您将需要确定是否要与TLS一起使用Docker-In-Docker。这需要更改
/etc/gitlab-runner/config.toml
设置,并在您的.gitlab-ci.yml
文件中分配docker_tls_tls_certdir
。请参阅 docker in gitlab文档的a>。Based on the error message I would ask, does the
gitlab-runner
user belong to thedocker
group?You will need to decide if you want to use Docker-in-Docker with, or without TLS. This requires changing
/etc/gitlab-runner/config.toml
settings, and assigning theDOCKER_TLS_CERTDIR
in your.gitlab-ci.yml
file. See the Docker-in-docker section of the GitLab docs.请检查以下内容以Prelim。
服务:
入口点:[“ dockerd-entrypoint.sh”,“ - tls = false”]
脚本:
Please check below things as prelim.
services:
entrypoint: ["dockerd-entrypoint.sh", "--tls=false"]
script: