I have a CI pipeline configured that has a docker image being built during the build phase.
I get an intermittent error:
"Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?"
when the build starts.
Sometimes it works, sometimes it doesn’t. When it doesn’t work, spamming the “Clear runner cache” button seems to help but not always. Doing a hard power cycle of the underlying kubernetes nodes works but thats not a great solution.
Any ideas why this would be so intermittent? I’ve tried many different settings in my .gitlab-ci.yml file, it currently looks like this:
stages:
- build
- deploy
- test
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://localhost:2375
build_app:
only:
- master
image: docker:stable
stage: build
script:
- docker info
- docker build -t ${CI_REGISTRY}/${CI_PROJECT_PATH}:${CI_COMMIT_REF_NAME} .
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}:${CI_COMMIT_REF_NAME}