Search code examples
dockergitlabgitlab-cidocker-registrygitlab-ci-runner

Using private docker registry for GitLab CI


I'm using gitlab.com and would like to build my project with the provided shared runners.

I have a docker image which contains all dependencies to build the project. The image is located at privateregistry.example.com. My .gitlab-ci.yml file looks like this:

image: privateregistry.example.com/myteam/myimage

before_script:
  - npm install

build:
  script:
    # ...

Since it is a private registry, I followed the instructions provided by gitlab and created under Settings -> Variables a variable DOCKER_AUTH_CONFIG, and used the contents of my local ~/.docker/config.json as value.

However, gitlab is not able to pull my image:

Running with gitlab-ci-multi-runner 1.8.0-rc.1 (1fd3fd4)
Using Docker executor with image privateregistry.example.com/myteam/myimage ...
Pulling docker image privateregistry.example.com/myteam/myimage ...
ERROR: Preparation failed: unauthorized: authentication required
Will be retried in 3s ...

What am I missing?


Solution

  • I didn't do anything wrong. Today, after clicking on "Rebuild", it just works.

    Edit: Sometimes it works, sometimes it does not. Thanks to gitlab.com for beeing reliable, guess I will need to setup my own runners.