terraform-aws-gitlab-runner icon indicating copy to clipboard operation
terraform-aws-gitlab-runner copied to clipboard

Allow setting runners.docker.services in toml

Open jonmcewen opened this issue 3 years ago • 4 comments
trafficstars

I've been trying to find a way to configure a docker mirror in the docker+machine runners, but had some problems. I have set runners_docker_registry_mirror

  1. If I set runners_add_dind_volumes, then a job script of docker info shows the Registry Mirrors, but this conflicts with services in jobs such as the auto-devops code_quality job, which also try to mount var/run/docker.sock.
  2. If I don't set runners_add_dind_volumes (using instead runners_additional_volumes to mount all but the docker.sock) then the services start correctly, but docker info doesn't show the mirror.

I think I have a workaround though, in which I start a docker service in the runner by modifying the config.toml

I have a requirement that users can use auto-devops without modification, so simply modifying the service(s) in the pipeline config is not an option.

Have I missed a trick, or is adding [[runners.docker.services]] a sensible approach? If so, I'll raise a PR to allow this.

jonmcewen avatar May 19 '22 07:05 jonmcewen

See also this issue for more background: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27173

jonmcewen avatar May 19 '22 12:05 jonmcewen

@npalm I'm working on a PR for this. Will be pretty basic initially, but will work for the docker mirror use case

jonmcewen avatar May 20 '22 08:05 jonmcewen

If I understand you correctly, @jonmcewen, the problem is, that the mirror disappears if runners_additional_volumes is used? Using runners_add_dind_volumes everything is fine.

Another question which came into my mind: Why is a job trying to mount a docker.sock? Do you have a link to the mentioned code_qualityjob?

kayman-mk avatar Jun 19 '22 11:06 kayman-mk

If I understand you correctly, @jonmcewen, the problem is, that the mirror disappears if runners_additional_volumes is used? Using runners_add_dind_volumes everything is fine.

Another question which came into my mind: Why is a job trying to mount a docker.sock? Do you have a link to the mentioned code_qualityjob?

Please see the first comment on this issue: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4260

Rest assured I spent many days going round in circles on this issue. I stand behind my solution until a better one is proposed.

jonmcewen avatar Aug 04 '22 08:08 jonmcewen

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.

github-actions[bot] avatar Mar 02 '23 03:03 github-actions[bot]

Guess this wasn't closed then #491 was merged months ago.

kayman-mk avatar Mar 02 '23 10:03 kayman-mk