Docker-in-docker not working in GitLab runner 1.8.2/1.9.2
We'd like to use a docker image to build other docker images. We are using GitLab Runner 1.9.2 and GitLab 8.14.5.
To do so, we want to use 'dind' as also propose in the gitlab documentation (https://about.gitlab.com/2016/05/23/gitlab-container-registry/). The yml file to build the container is the following:
image: docker:git
services:
- docker:dind
build:
stage: build
script:
- docker build -t xxxx .
There is privileged runner (type: docker) in place to run this image; toml looks the following:
concurrent = 1
check_interval = 0
[[runners]]
name = "privileged Docker Container"
url = "xxxx"
token = "xxxxxx"
executor = "docker"
[runners.docker]
tls_verify = false
image = "docker:git"
privileged = true
disable_cache = false
volumes = ["/cache"]
[runners.cache]
The build fails with the following log output
Running with gitlab-ci-multi-runner 1.9.2 (ade6572)
Using Docker executor with image docker:git ...
Using locally found image version due to if-not-present pull policy
Starting service docker:dind ...
Waiting for services to be up and running...
*** WARNING: Service runner-f8e34f23-project-44-concurrent-0-docker probably didn't start properly.
API error (500): Cannot link to a non running container: /runner-f8e34f23-project-44-concurrent-0-docker AS /runner-f8e34f23-project-44-concurrent-0-docker-wait-for-service/runner-f8e34f23-project-44-concurrent-0-docker
2017-01-07T15:49:33.983316200Z mount: permission denied (are you root?)
2017-01-07T15:49:33.983409300Z Could not mount /sys/kernel/security.
2017-01-07T15:49:33.983420821Z AppArmor detection and --privileged mode might break.
2017-01-07T15:49:34.008670065Z mount: permission denied (are you root?)
*********
Using locally found image version due to if-not-present pull policy
Running on runner-f8e34f23-project-44-concurrent-0 via gl...
Cloning repository...
Cloning into '/builds/base-tech/BuildSystem'...
Checking out 44a1bd78 as master...
$ docker build -t xxxx .
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
ERROR: Build failed: exit code 1
We also updated the Gitlab Runner 1.8.2 to 1.9.2 which didn't change anything.