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
2
Answers
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.Please check below things as prelim.
services:
entrypoint: ["dockerd-entrypoint.sh", "–tls=false"]
script: