Tincu Alexandra
Tincu Alexandra

Reputation: 25

How to fix docker services failing with generic error?

I have an issue in which Gitlab CI jobs are failing with an error like: docker: Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running?

This doesn't really say much and doesn't make any sense because locally the connection can be established and the commands work as expected.

Commands: build / login / push (are set in the gitlab-ci.yml), but they don't work when using the custom gitlab-runners configured on our server.

Do you have any suggestions for this?

Thank you!

Upvotes: 1

Views: 198

Answers (1)

Rareș Flueraș
Rareș Flueraș

Reputation: 324

Hello,

I have had the same problem a couple of days ago with minimum / limited chance of finding the solution.

This is actually a known issue, you can find all of the details here: https://gitlab.com/gitlab-org/gitlab-runner/issues/4501

Using docker:latest in your containers will definitely lead you at some point to this problem.


Short answer (if this is your case):

Docker 19.03 enables TLS by default, thus the configurations for certificates are required:

  1. Add in your config.toml (/etc/gitlab-runner/)

[[runners]] environment = ["DOCKER_TLS_CERTDIR="]

  1. Add in your gitlab-ci.yml (from the project)

variables: DOCKER_TLS_CERTDIR: ""


This will offer the mandatory configurations for finding the certificates and run properly even though they are not any set (yet, or ever).

It will resolve your problem for the moment, hopefully will be fixed in future docker images.

Hope this helps :)

Upvotes: 2

Related Questions