0

reading the documentation on autoscaling I can't figure the role of the [runner.docker] section when using docker+machine as executor :

  [runners.docker]
    image = "ruby:2.1"               # The default image used for builds is 'ruby:2.1'

In the executors documentation it says :

docker+machine : like docker, but uses auto-scaled docker machines - this requires the presence of [runners.docker] and [runners.machine]

I get I have to define this [runners.docker] section to be able to use [runners.machine] section, but what is the aim of this [runners.docker] ? I can't find how to configure it as I don't understand why to use it.

Our gitlab-runner runs on a vSphere VM and is configured to scale using docker+machine executor with MachineDriver using vmwarevsphere. All works nice but I would like to understand fully the configuration file.

Here is our "censored with stars" config.toml file with the [runners.docker] I can't understand (note that the guy that wrote it leaved the company, so I can't ask him):

[[runners]]
  name = "gitlab-runner"
  limit = 6
  output_limit = 102400
  url = "http://gitlab.**************.lan"
  token = "*******************"
  executor = "docker+machine"

  [runners.docker]
    tls_verify = false
    image = "docker:latest"
    dns = ["*.*.*.*"]
    privileged = true
    disable_cache = false
    volumes = ["/etc/localtime:/etc/localtime:ro", "/var/run/docker.sock:/var/run/docker.sock", "/etc/docker/certs.d:/etc/docker/certs.d", "/cache:/cache", "/builds:/builds"]
    cache_dir = "cache"
    shm_size = 0

  [runners.cache]
    Type = "s3"
    ServerAddress = "*.*.*.*"
    AccessKey = "*****************"
    SecretKey = "*****************"
    BucketName = "runner"
    Insecure = true

  [runners.machine]
    IdleCount = 4
    MaxBuilds = 10
    IdleTime = 3600
    MachineDriver = "vmwarevsphere"
    MachineName = "gitlab-runner-pool-1-%s"
    MachineOptions = ["vmwarevsphere-username=************", "vmwarevsphere-password=*****************", "vmwarevsphere-vcenter=*.*.*.*", "vmwarevsphere-datastore=*********", "vmwarevsphere-memory-size=3096", "vmwarevsphere-disk-size=40960", "vmwarevsphere-cpu-count=3", "vmwarevsphere-network=*****************", "vmwarevsphere-datacenter=**************", "vmwarevsphere-hostsystem=*******************", "engine-storage-driver=overlay2", "engine-insecure-registry=**************", "engine-insecure-registry=*******************"]
    OffPeakPeriods = ["* * 0-8,21-23 * * mon-fri *", "* * * * * sat,sun *"]
    OffPeakTimezone = "Local"
    OffPeakIdleCount = 1
    OffPeakIdleTime = 600

1 Answer 1

1

The [runners.machine] section defines how to start and provision your runner machines, the [runners.docker] section then defines how to configure the runner on that machine.

Docker-machine on its own only does the following (as you can read here):

"Docker Machine is a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with docker-machine commands."

So this does nothing with the Gitlab runner, you still need to configure the runner after that and thats where the [runners.docker] section comes into play because the runner needs to know what default image to use and what volumes to mount etc.

2
  • Ok, but if I understand, runners.machine parts determine how the VM will be created on the vsphere server using the vsphere driver. Then on this VM built from the boot2docker iso by docker machine, a docker engine is running. When I run my CI pipeline I define the docker image to be used in the .gitlab-ci.yml file. In our case most of the time a gradle:latest. So when this runner.docker image parameter in the config.toml is used and for which containers, because in the end it seems to me that this parameter is never used. So why is it requested in the manual? Dec 15, 2017 at 19:19
  • Yeah that is correct. If you define it in your yml files you dont need it. The docs cover the fact that you e.g. define shared runners with this docker machine config. It is the case in our company, so if someone doesnt define an image in his yml the default one in runner.docker is used. Dec 15, 2017 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.