Gitlab-runner with insecure registry

Using Gitlab-Runner with an insecure registry

I have a self hosted Gitlab-CE server, and a self hosted docker registry (accessible through LAN only, so HTTP only). The goal is to be able to run pipelines, where the .gitlab-ci.yml pulls a docker image from this private docker repository. However, every time a job starts, the following error is thrown:

Running with gitlab-runner 13.5.0 (ece86343) on AS02 Docker Container Runner TcPipUEK
Preparing the "docker" executor
Using Docker executor with image 172.30.100.15:5050/gradle:6.7-openjdk-12-alpine ...
Authenticating with credentials from $DOCKER_AUTH_CONFIG
Pulling docker image 172.30.100.15:5050/gradle:6.7-openjdk-12-alpine ...
ERROR: Preparation failed: Error response from daemon: Get https://172.30.100.15:5050/v2/: http: server gave HTTP response to HTTPS client (docker.go:142:0s)

So more concretely, it won’t successfully connect to and download from the private registry at 172.30.100.15:5050. I have the docker login credentials stored in $DOCKER_AUTH_CONFIG, and my Gitlab-Runner’s compose file looks like this:

version: '3'

services:
  gitlab-runner:
    restart: always
    image: gitlab/gitlab-runner:latest
    ports:
      - "8093:8093"
    environment:
      TZ: Europe/Zurich
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./gitlab-runner-config:/etc/gitlab-runner
    command: ["--insecure-registry=172.30.100.15:5050"]

Is there something I’m missing? The docs seem unclear on how to allow gitlab-runner's docker to connect to an insecure registry, does anyone know what needs to be done to get this working?

I figured out a way to solve this:

On the server on which the GitLab Runner is running, add the following option to your docker launch arguments (for me I added it to the DOCKER_OPTS in /etc/default/docker and restarted the docker engine): --insecure-registry 172.30.100.15:5050, replacing the IP with your own insecure registry.