Gitlab-runner fails with docker in docker build on Debian Stretch
Summary
Jobs running in docker, trying to execute docker commands result in failures to connect:
error during connect: Get http://docker:2375/v1.32/info: dial tcp: lookup docker on 10.2.6.33:53: no such host
GitLab runner version
# gitlab-runner --version
Version: 10.0.2
Git revision: a9a76a50
Git branch: 10-0-stable
GO version: go1.8.3
Built: Wed, 04 Oct 2017 12:40:13 +0000
OS/Arch: linux/amd64
Steps to reproduce
- Install Debian Stretch (kernel: 4.9.0-3-amd64)
- Install gitlab-runner
- config.toml:
concurrent = 1
check_interval = 0
[[runners]]
name = "###########"
url = "https://gitlab.com/"
token = "#######################"
executor = "docker"
[runners.docker]
tls_verify = false
image = "python:3"
privileged = true
disable_cache = false
volumes = ["/cache", "/etc/hosts:/etc/hosts"]
shm_size = 0
[runners.cache]
Then run a docker-in-docker job.
Running even the simplest job fails.
Example Project
image: docker:latest
services:
- docker:dind
stages:
- test
test-build:
stage: test
script:
- echo "all goood"
- docker info
tags:
- docker
https://gitlab.com/trivago/rta/dind-testr
What is the current bug behavior?
https://gitlab.com/trivago/rta/dind-testr/-/jobs/36130074
What is the expected correct behavior?
On shared runners it works as expected: https://gitlab.com/trivago/rta/dind-testr/-/jobs/36129880
Relevant logs and/or screenshots
Pulling docker image docker:latest ...
Using docker image docker:latest ID=sha256:a2a81dbb88b8d6933bf31d56de831b7ee2afb8eab11bd870411883da13ee127d for build container...
Running on runner-6edfe9f9-project-4377802-concurrent-0 via rta-gitlabrunner-prod1...
Cloning repository...
Cloning into '/builds/trivago/rta/dind-testr'...
Checking out b8d24279 as master...
Skipping Git submodules setup
$ echo "all goood"
all goood
$ docker info
error during connect: Get http://docker:2375/v1.32/info: dial tcp: lookup docker on 10.2.6.33:53: no such host
ERROR: Job failed: exit code 1
- Running this on local works
- Running the container on the server with docker-in-docker also works:
root@rta-gitlabrunner-prod2:~# docker run --privileged --name some-docker -d docker:stable-dind
Unable to find image 'docker:stable-dind' locally
stable-dind: Pulling from library/docker
Digest: sha256:effc528b6b06b773d3353c3ef2e772d430cbd6a74103a5e2c9f01e2795485ce3
Status: Downloaded newer image for docker:stable-dind
058547f5ee1746568eee3c93110294e9af0c04abf708c46a6bdea0aa03932b3b
root@rta-gitlabrunner-prod2:~# docker run --rm --link some-docker:docker docker:edge version
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:39:28 2017
OS/Arch: linux/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:45:38 2017
OS/Arch: linux/amd64
Experimental: false
Output of checks
This bug happens on GitLab.com