I have set up a docker runner, where I want to run an image stored on a local repository. My /etc/gitlab-runner/config.toml is
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "Docker runner"
url = "https://gitlab.str.corp/"
token = "*secret*"
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "gitlab.example.com:4443/docker:19.03.1-dind"
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/certs/client", "/cache"]
shm_size = 0
When I submit the job, it starts on the runner, but fails to pull the image:
Running with gitlab-runner 13.4.0 (4e1f20da)
on Docker runner abcde123
Preparing the "docker" executor
Using Docker executor with image gitlab.example.com:4443/docker:19.03.8-git ...
Starting service gitlab.example.com/docker:19.03.1-dind ...
Authenticating with credentials from /root/.docker/config.json
Pulling docker image gitlab.example.com:4443/docker:19.03.1-dind ...
ERROR: Job failed: Error response from daemon: pull access denied for gitlab.example.com:4443/docker, repository does not exist or may require 'docker login': denied: requested access to the resource is denied (docker.go:142:0s)
The docker login is the problem. If I try to do docker pull <image> from the command line, I get the same error. A docker login then lets me pull the image.
I am pretty certain that I just need to do echo $CI_JOB_TOKEN | docker login -u gitlab-ci-token --password-stdin $CI_REGISTRY before pulling the image, but I don't know how to cause that to be run.
The docker image is stored in the gitlab integrated repository. This page makes it seem that the authentication should be automatically set up, but that is clearly not the case.
What do I need to do to be able to be able to pull the privately stored image.