Skip to content

Instantly share code, notes, and snippets.

@barnybug
Created November 21, 2017 11:14
Show Gist options
  • Save barnybug/e988cfcd937e7414187c51f4d1e2cb82 to your computer and use it in GitHub Desktop.
Save barnybug/e988cfcd937e7414187c51f4d1e2cb82 to your computer and use it in GitHub Desktop.
Docker compose for a Docker-in-docker gitlab runners setup
# Docker-in-Docker Gitlab runners setup taken from:
# https://medium.com/@tonywooster/docker-in-docker-in-gitlab-runners-220caeb708ca
dind:
restart: always
privileged: true
volumes:
- /var/lib/docker
image: docker:17.09.0-ce-dind
command:
- --storage-driver=overlay2
runner:
restart: always
image: gitlab/gitlab-runner:alpine
volumes:
- ./gitlab/runner:/etc/gitlab-runner:Z
environment:
- DOCKER_HOST=tcp://dind:2375
register-runner:
restart: 'no'
image: gitlab/gitlab-runner:alpine
volumes:
- ./gitlab/runner:/etc/gitlab-runner:Z
command:
- register
- --non-interactive
- --locked=false
- --name=Docker Runner
- --executor=docker
- --docker-image=docker:17.09.0-ce-dind
- --docker-volumes=/var/run/docker.sock:/var/run/docker.sock
environment:
- CI_SERVER_URL=https://gitlab.example.com/
- REGISTRATION_TOKEN=see_gitlab_admin_runner_setup
@JNaomad
Copy link

JNaomad commented Dec 21, 2018

Very useful docker-compose .. but my runner give me this error : runner_1 | WARNING: Preparation failed: error during connect: Get http://dind:2375/v1.18/info: dial tcp: lookup dind on 8.8.8.8:53: no such host (executor_docker.go:1161:20s) job=14 project=2 runner=70f00f4c
runner_1 | Will be retried in 3s ..

Some help will be appreciate... thanks

@dnsmichi
Copy link

dnsmichi commented Aug 7, 2020

I've found this Gist from a forum question. In case you land here as well, please join the ideas and solutions over there :-)

https://forum.gitlab.com/t/runner-registration-failed-in-centos-7/40072/4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment