I have configured gitlab runner within kubernetes , which is not able to connect to docker daemon . Showing below error .
docker build --cache-from “${DOCKER_IMAGE_TAG}” -t “${DOCKER_IMAGE_TAG}” .
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? ERROR: Job failed: command terminated with exit code 1
stages:
- push_to_docker
docker_image:
image: 'docker:latest'
services:
- docker:dind
stage: push_to_docker
variables:
DOCKER_IMAGE_TAG: 'gcr.io/abcd-project/test'
script:
- docker build --cache-from "${DOCKER_IMAGE_TAG}" -t "${DOCKER_IMAGE_TAG}" .
- echo "$SERVICE_ACCOUNT_KEY" > key.json
- docker login -u _json_key --password-stdin https://gcr.io < key.json
- docker push ${DOCKER_IMAGE_TAG}
only:
- master
tags:
- abcd
My config.toml file is as below
listen_address = "[::]:9252"
concurrent = 4
check_interval = 3
log_level = "info"
[session_server]
session_timeout = 1800
[[runners]]
name = "runner-gitlab-runner-78c7db94bc-lzv76"
request_concurrency = 1
url = "https://gitlab.com/"
token = "*********"
executor = "kubernetes"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.kubernetes]
host = ""
bearer_token_overwrite_allowed = false
image = "ubuntu:16.04"
namespace = "gitlab-managed-apps"
namespace_overwrite_allowed = ""
privileged = true
service_account_overwrite_allowed = ""
pod_annotations_overwrite_allowed = ""
[runners.kubernetes.pod_security_context]
[runners.kubernetes.volumes]