sk DYLAN
sk DYLAN

Reputation: 61

Docker in docker service broken Gitlab CI/CD

CI job uses docker:dind image as a service for a specific build. However, in execution I get the error

.gitlab-ci.yml:

image: tmaier/docker-compose:latest

services:
  - docker:18.09.7-dind

variables:
  DOCKER_DRIVER: overlay2

stages:
  - test
  - build
  - push
  - clean-up

before_script:
  - docker info
  - apk update
  - apk add make
  - make down

test:
  stage: test
  tags: [test]
  image: tiangolo/docker-with-compose:latest
  script:
    - make prod-up
    - make composer-init-dev
    - make test

config.toml:

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800
[[runners]]
  name = "My Docker Runner"
  url = "https://###/"
  token = "FRft8kukkz3qwXw6kkFJ"
  executor = "docker"
  pre_clone_script = "git config --global http.sslVerify false"
  [runners.custom_build_dir]
  [runners.docker]
    tls_verify = false
    image = "tiangolo/docker-with-compose"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
  [runners.cache]
    Insecure = false
    [runners.cache.s3]
    [runners.cache.gcs]

Error:

Server: ERROR: Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running? errors pretty printing info ERROR: Job failed: exit code 1

All information about this problen https://gitlab.com/gitlab-org/gitlab-runner/-/issues/26727

Upvotes: 0

Views: 1371

Answers (1)

Konrad Botor
Konrad Botor

Reputation: 5063

In case someone stumbles upon this question and doesn't want to read the comments and question edits to find the solution to the problem:

In OP's original CI configuration there were two docker-in-docker services declared:

  • global docker:18.09.7-dind
  • job-specific: docker:dind

It seems that they interfered with each other and when OP removed the job-specific one, everything started to work.

Upvotes: 1

Related Questions