Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab CI runner can't connect to tcp://localhost:2375 in kubernetes

I followed this doc to install Gitlab on GKE : https://docs.gitlab.com/ee/install/kubernetes/gitlab_chart.html

My installation's parameters are :

helm upgrade --install gitlab gitlab/gitlab \
  --timeout 600 \
  --set global.hosts.domain=***** \
  --set global.hosts.externalIP=***** \
  --set certmanager-issuer.email=***** \
  --set gitlab.migrations.image.repository=registry.gitlab.com/gitlab-org/build/cng/gitlab-rails-ce \
  --set gitlab.sidekiq.image.repository=registry.gitlab.com/gitlab-org/build/cng/gitlab-sidekiq-ce \
  --set gitlab.unicorn.image.repository=registry.gitlab.com/gitlab-org/build/cng/gitlab-unicorn-ce \
  --set gitlab.unicorn.workhorse.image=registry.gitlab.com/gitlab-org/build/cng/gitlab-workhorse-ce \
  --set gitlab.task-runner.image.repository=registry.gitlab.com/gitlab-org/build/cng/gitlab-task-runner-ce \
  --set gitlab.gitlab-runner.runners.privileged=true \
  --set gitlab.gitlab-runner.runners.cache_dir="cache"

Then I created my .gitlab-ci.yaml :

image: docker:latest

services:
  - docker:dind

variables:
  DOCKER_HOST: tcp://localhost:2375

stages:
  - package

package:
  stage: package
  before_script:
    - echo "${GKE_JSON_AUTH}" > gke-project-auth.json || exit 1
    - cat gke-project-auth.json | docker login -u _json_key --password-stdin https://eu.gcr.io || exit 1
  script:
    - docker info

I have read many threads, all get the solution in DOCKER_HOST and privilegedparameter, but I've always got this error :

Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?

I also tried to put in a values.yaml file :

runners:
  privileged: true

and exectue this command :

helm upgrade --reuse-values gitlab gitlab/gitlab -f values.yaml

But without unsuccessfully...

Any idea? Thanks!

like image 314
julesvil Avatar asked Jan 02 '23 05:01

julesvil


2 Answers

Apparently, according to this, this issue is more recently related to docker's update of its image docker:dind which use the last version of docker server which is not listening anymore at 2375 but at 2376.

So I updated my .gitlab-ci.yml as suggested in that entry and it worked for me:

image: docker:stable

services:
  - docker:18.09-dind

...

[UPDATE]

This was a temporary workaround. The docker:stable and docker:stable-dind images are now fixed.

like image 127
LeandroOrdonez Avatar answered Jan 04 '23 02:01

LeandroOrdonez


I found my mistake. The "Installation command line options" we can see here : https://gitlab.com/charts/gitlab/blob/master/doc/installation/command-line-options.md says the privileged parameter is gitlab-runner.runners.privileged not gitlab.gitlab-runner.runners.privileged (and cache_dir doesn't exist). So now it's OK with :

--set gitlab-runner.runners.privileged=true
like image 27
julesvil Avatar answered Jan 04 '23 01:01

julesvil