简体   繁体   English

对GitLab CI使用私有Docker注册表

[英]Using private docker registry for GitLab CI

I'm using gitlab.com and would like to build my project with the provided shared runners. 我正在使用gitlab.com,并希望使用提供的共享运行器来构建我的项目。

I have a docker image which contains all dependencies to build the project. 我有一个泊坞窗映像,其中包含构建项目的所有依赖项。 The image is located at privateregistry.example.com . 该图像位于privateregistry.example.com My .gitlab-ci.yml file looks like this: 我的.gitlab-ci.yml文件如下所示:

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. 由于它是一个私有注册表,因此我按照gitlab提供说明进行操作,并在Settings -> Variables下创建了变量DOCKER_AUTH_CONFIG ,并使用了本地~/.docker/config.json作为值。

However, gitlab is not able to pull my image: 但是,gitlab无法拉出我的图像:

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? 我想念什么?

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. 感谢gitlab.com的出色表现,我想我需要设置自己的跑步者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM