1

I want to run Gitlab CI Runner in a docker container while also using the docker executor to run my builds in their own docker containers, all of that on top of CoreOS.

Is this even possible? Every documentation I've found so far assumes that Gitlab Runner is running on the host OS which is not a viable option for me.

The alternative would be to have specialised gitlab-runner containers with the build dependencies installed in each one.

2 Answers2

1

There is --privileged parameter

https://docs.docker.com/engine/reference/run/#/runtime-privilege-and-linux-capabilities

Which should give capability to run docker inside docker. So theoretically it possible, but you probably run into other problems.

tojo
  • 121
  • 2
0

You need to mount docker.sock , set --privileged

docker run -d  -v /var/run/docker.sock:/var/run/docker.sock --name gitlab-runner --privileged --restart always -v d:/docker/data/gitlab-runner:/etc/gitlab-runner gitlab/gitlab-runner:latest

And set config privileged .

[[runners]]

  name = "docker2"
  url = "https://gitlab.com/"
  token = "xxxxx"
  executor = "docker"
  [runners.docker]
    image = "alpine:latest"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    shm_size = 0
Hlex
  • 101
  • 1