对GitLab CI使用私有Docker注册表 [英] Using private docker registry for GitLab CI
问题描述
我正在使用 gitlab.com ,并希望使用提供的共享运行器来构建我的项目.
I'm using gitlab.com and would like to build my project with the provided shared runners.
我有一个docker映像,其中包含构建项目的所有依赖项.该图像位于 privateregistry.example.com
.我的 .gitlab-ci.yml
文件如下所示:
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.
但是,gitlab无法提取我的图片:
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 ...
我想念什么?
推荐答案
我没有做错任何事情.今天,点击重建"后,它就可以使用了.
I didn't do anything wrong. Today, after clicking on "Rebuild", it just works.
有时可以,有时不能.感谢gitlab.com的出色表现,我想我需要设置自己的跑步机.
Sometimes it works, sometimes it does not. Thanks to gitlab.com for beeing reliable, guess I will need to setup my own runners.
这篇关于对GitLab CI使用私有Docker注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!