Runner cannot pull images from private registry even though the DOCKER_AUTH_CONFIG is correct

Runner cannot pull images from private registry even though the DOCKER_AUTH_CONFIG is correct

  • Hello. I have a job that starts a docker compose instance with some docker images from our private registry. The host machine of the runner is authorized to pull these images and does so successfully. However, the gitlab runner cannot pull the images and tells me that it’s access is forbiddden to our private registry. Following gitlab’s docs, I created a DOCKER_AUTH_CONFIG variable in our gitlab projects settings. The value of DOCKER_AUTH_CONFIG is the output of cat ~/.docker/config.json on the gitlab runner’s host machine.

  • .gitlab-ci.yml

stages:
  - Test

E2E Test:
  stage: Test
  image: custom-python-image
  services:
   - name: docker:dind
     alias: dockerhost

  variables:
    DOCKER_HOST: tcp://dockerhost:2375/
    DOCKER_TLS_CERTDIR: ""

  script:
    - python3 --version
    - docker compose version
    - cd project
    - docker compose up -d
  tags:
    - e2e
  • custom-python-image Dockerfile
FROM docker:20.10-dind

RUN apk update
# Install Python3.8 and pip
RUN apk add --no-cache \
        python3 \
        py3-pip \
        python3-dev \
        gcc \
        libc-dev \
        chromium \
        chromium-chromedriver

CMD ["sh"]
  • config.toml
[[runners]]
  name = "sim-e2e-runner"
  url = "https://gitlab.com/"
  token = "MY_TOKEN"
  executor = "docker"

  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "python"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
    pull_policy = ["never"]
  • ~/.docker/config.json
{
        "auths": {
                "registry.gitlab.com": {
                        "auth": "MY_BASE64_CREDENTIALS"
                }
        }
}

Are you using self-managed or GitLab.com?

  • self-hosted runner

What version are you on?

Version:      15.1.0
Git revision: 76984217
Git branch:   15-1-stable
GO version:   go1.17.7
Built:        2022-06-20T10:10:54+0000
OS/Arch:      linux/amd64
  • Please let me know if theres any other information I can provide. Thank you!!!