0

Preliminaries

I am using Gitlab Community Edition 12.0.3, in which I have standard project admin permissions but no more. The installation only has few and slow CI runners, so I went and created a small dedicated Kubernetes cluster on GCE for one of my projects. I followed the step-by-step documentation under Gitlab => Project => Settings => CI/CD => Runners => Specific Runners => Learn more about Kubernetes (or in other words, https://docs.gitlab.com/ee/user/project/clusters/ ), and all worked fine. I.e., Gitlab created the Kubernetes manifests like Helm Tiller and the runner pods, and so on.

Problem

My .gitlab-ci.yml looks like this:

image: docker:stable

services:
  - docker:dind

before_script:
  - docker info

build:
  stage: build
  script:
    - cd etc/docker && bash -c ./build.sh

build.sh runs docker build commands to, well, build the container(s) which will later be used to run the tests. It's contents are irrelevant for this question, as the docker info already fails:

Running with gitlab-runner 11.11.2 (********)
  on runner-gitlab-runner-**************** ********
Using Kubernetes namespace: gitlab-managed-apps
Using Kubernetes executor with image docker:stable ...
Waiting for pod gitlab-managed-apps/runner-***-****-*******-****-**********-****** to be running, status is Pending
Waiting for pod gitlab-managed-apps/runner-***-****-*******-****-**********-****** to be running, status is Pending
Running on runner-***-****-*******-****-**********-****** via runner-gitlab-runner-**********-*****...
Initialized empty Git repository in /builds/***/***/.git/
Fetching changes with git depth set to 50...
Created fresh repository.
From https://***/***/***
 * [new branch]      *** -> origin/***
Checking out *** as ***...

Skipping Git submodules setup
$ docker info
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

The gitlab/gitlab-runner:alpine image that is used here is minimal; it contains the gitlab-runner and nothing else (specifically, it does not contain docker executable and does not mount the host docker socket in for DIND). It does seem to find/execute my .gitlab-ci.yml as it does try to execute the docker info command; but I had expected that it would then pull the docker:stable image specified in there, and execute the before and build scripts within that image (where docker would be available).

Question(s)

I seem to be missing something fundamental here.

Do I need to specify a different gitlab-runner image? How? No such setting is in the gitlab project admin GUI. Do I need to do the setup of the gitlab-runner pod myself (but then, what point is there in gitlab being able to do that for me)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.