I was hoping to get some assistance with Gitlab runner instance which
throws "Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?"
my gitlab-ci.yml
:
image: docker:18.09-dind
variables:
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2
stages:
- build
- test
before_script:
- export REACT_APP_USERS_SERVICE_URL=http://127.0.0.1
job:
stage: build
script:
- apk add --update --no-cache gcc g++ make python2 python2-dev py-pip python3-dev curl
- curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- chmod +x /usr/local/bin/docker-compose
- docker-compose up -d --build
- docker logs testdriven_e2e:latest -f
after_script:
- docker-compose down
error output:
(32/34) Installing pkgconf (1.6.1-r1)
(33/34) Installing python2-dev (2.7.18-r0)
(34/34) Installing python3-dev (3.7.10-r0)
Executing busybox-1.30.1-r2.trigger
OK: 339 MiB in 73 packages
$ curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 664 100 664 0 0 2699 0 --:--:-- --:--:-- --:--:-- 2688
100 23.5M 100 23.5M 0 0 3546k 0 0:00:06 0:00:06 --:--:-- 4406k
$ chmod +x /usr/local/bin/docker-compose
$ docker-compose up -d --build
Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
ERROR: Job failed: exit code 1
FATAL: exit code 1
Thank you in advance for any suggestions.
2
Answers
You must add the docker-in-docker service, then set the daemon host to the hostname
docker
(which is the hostname of the dind service)Summarized
@sytech ans helped me. But if you still have no issue please check below things
--docker-privileged
Example:
Let me know if you still have an issue