为 GitLab CI 使用私有 docker 注册表
Using private docker registry for GitLab CI
我正在使用 gitlab.com 并希望使用提供的共享运行器构建我的项目。
我有一个 docker 图像,其中包含构建项目的所有依赖项。图片位于 privateregistry.example.com
。我的 .gitlab-ci.yml
文件如下所示:
image: privateregistry.example.com/myteam/myimage
before_script:
- npm install
build:
script:
# ...
由于是私有注册表,我按照instructions provided by gitlab在Settings -> Variables
下创建了一个变量DOCKER_AUTH_CONFIG
,并使用我本地~/.docker/config.json
的内容作为值.
但是,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 ...
我错过了什么?
我没有做错任何事。今天,点击"Rebuild"后,就可以了。
编辑: 有时有效,有时无效。感谢 gitlab.com 的可靠,我想我需要设置自己的跑步者。
我正在使用 gitlab.com 并希望使用提供的共享运行器构建我的项目。
我有一个 docker 图像,其中包含构建项目的所有依赖项。图片位于 privateregistry.example.com
。我的 .gitlab-ci.yml
文件如下所示:
image: privateregistry.example.com/myteam/myimage
before_script:
- npm install
build:
script:
# ...
由于是私有注册表,我按照instructions provided by gitlab在Settings -> Variables
下创建了一个变量DOCKER_AUTH_CONFIG
,并使用我本地~/.docker/config.json
的内容作为值.
但是,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 ...
我错过了什么?
我没有做错任何事。今天,点击"Rebuild"后,就可以了。
编辑: 有时有效,有时无效。感谢 gitlab.com 的可靠,我想我需要设置自己的跑步者。