If you are using docker in docker (dind) to create docker containers in a gitlab environment you can use the following snippet to easily use an insecure registry:
dockercreation:
stage: building
image: docker:latest
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
variables:
DOCKER_DRIVER: overlay2
services:
- name: docker:dind
command: ["dockerd-entrypoint.sh", "--insecure-registry=YOUR_HOST:YOUR_PORT"]
script:
- echo "create some docker here"
An insecure registry with public access is of course a bad idea …