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 privileged
parameter, 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!
This solution using docker:18.09
and docker:18.09-dind
images works.
.gitlab-ci.yml
:
build_image:
stage: build
image: docker:18.09
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
services:
- docker:18.09-dind
More discussion on this issue: https://gitlab.com/gitlab-org/gitlab-runner/issues/4501
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.
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
The Docker-in-Docker service will be named after its image name: docker. You should set DOCKER_HOST
to tcp://docker:2375
.