Support for distributed docker registry mirror for docker (NOT docker+machine) executors

Description

I would like to run the official docker registry (v2) in the proxy/pull-through mode in order to speed up Gitlab CI/CD builds running on our local hardware.

We are building for both x86_64 and arm64v8 architecture and downloading the images (i.e. including CUDA ~ 500MB-1.1GB) is a bottleneck. We virtually execute all of our CICD on our local runners.

Our images are pulled from the registry at Gitlab.com and are therefore tagged along the lines of registry.gitlab.com/group/subgroup/subgroup/packagename/cuda:latest These are used as base images for i.e. building C/C++ packages using Conan.

Using a box standard setup of the registry-mirror and with a /etc/docker/daemon.json:

{
          "registry-mirrors": ["http://192.168.1.108:5000"],
          "insecure-registries" : ["192.168.1.108:5000"]
}

I can successfully speed up images that do not contain a URL at the beginning:

WORKS DOES NOT WORK
alpine:latest registry.gitlab.com/group/packagename/cuda:latest

Images that do contain the url are being pulled directly from the respective registry i.e. gitlab.com

Using the docker+machine executor one can specify a

[runners.machine]
  MachineOptions = [
      "engine-registry-mirror=http://my.local.registry.mirror.com/"
  ]

This is currently not possible with the pure docker executor.

Proposal

(Assuming this is within scope of the gitlab-runner and not just a docker client issue:

  [runners.docker]
    registry_mirrors = ["http://my.local.registry.mirror.com/"]

Links to related issues and merge requests / references

#3322 (closed)

gitlab-com/support-forum#4641

Edited by 🤖 GitLab Bot 🤖