简体   繁体   English

Gitlab CI 不适用于 Gitlab 注册表中的私有图像

[英]Gitlab CI doesn't work with private image in Gitlab Registry

I have an image gitlab.com/arxeiss/deployer and project gitlab.com/arxeiss/my-project with .gitlab-ci.yml file:我有一个图像gitlab.com/arxeiss/deployer和项目gitlab.com/arxeiss/my-project.gitlab-ci.yml文件:

deploy:
  image: registry.gitlab.com/arxeiss/deployer
  stage: build

When I push to origin, pipeline works and image is pulled successfully.当我推送到原点时,管道工作并且图像被成功拉出。 But when someone else pushes, who doesn't have access to deployer this error is thrown: Error response from daemon: pull access denied for registry.gitlab.com/arxeiss/deployer, repository does not exist or may require 'docker login'但是当其他人推送时,谁无权访问部署程序,则会抛出此错误: Error response from daemon: pull access denied for registry.gitlab.com/arxeiss/deployer, repository does not exist or may require 'docker login'

I have found in Documentation that I need DOCKER_AUTH_CONFIG and the way how to set it up .我在文档中发现我需要DOCKER_AUTH_CONFIG以及设置方法。 But that means, I have to put auth token from docker login and ~/.docker/config.json into CI/CD Variables.但这意味着,我必须将来自docker login~/.docker/config.json的身份验证令牌放入 CI/CD 变量中。

But that is assigned to my account.但那是分配到我的帐户。 So someone can use it and if I reset password etc. it stops working.所以有人可以使用它,如果我重设密码等,它就会停止工作。 Is there different way how to make it work?有没有不同的方法让它工作?

If you don't want to use your regular credentials, you can use a personal access token or deploy token instead - see here .如果您不想使用常规凭据,则可以改用个人访问令牌或部署令牌 - 请参阅此处

That way it'll still work if you change your password and, as a bonus, you can revoke it without changing your regular password.这样,如果您更改密码,它仍然有效,而且作为奖励,您可以在不更改常规密码的情况下撤销它。

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

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