GitLab CI: failed to dial gRPC: cannot connect to the Docker daemon. Is 'docker daemon' running on this host?

Posted on Jul 28, 2019

The latest docker:dind has breaking changes. Here are two fixes if you are enchanting issues with GitLab CI and your runners.

Fix 1: GitLab CI Config

Add the following to your .gitlab-ci.yml

variables:
    DOCKER_TLS_CERTDIR: ""

Fix 2: Change runner config

Alternatively, another fix is to change the runner:

$ nano /etc/gitlab-runner/config.toml

Modify to mach the following (specifically environment and volumes)

[[runners]]
  environment = ["DOCKER_DRIVER=overlay2","DOCKER_TLS_VERIFY=1","DOCKER_CERT_PATH=/certs/client"]
  [runners.docker]
    image = "docker:dind"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache","/certs"]

Then restart the gitlab runner

$ service gitlab-runner restart

I hope at least one of these fixes resolves your issues.