在群模式下部署Docker映像时出现Gitlab-CI错误

时间:2020-06-30 09:02:47

标签: docker gitlab gitlab-ci

嗨,我在运行Docker群模式的服务器上更新/更改我的服务映像时遇到问题。 这是手动更新服务的过程。

  1. 将项目从本地计算机推送到gitlab。
  2. 从服务器中的gitlab拉项目。
  3. 使用my-project:latest
  4. 构建Docker映像
  5. my-project:latest标记为registry.gitlab.com/my-group/my-project:staging
  6. 我使用docker push registry.gitlab.com/my-group/my-project:staging推送图像
  7. 我运行docker stack deploy -c ~/docker-stack.yml api --with-registry-auth 而且效果很好。

但是,即使我成功完成了上述工作,如果我仍将上面的代码移动到gitlab-ci.yml中,当我尝试更新服务时就会收到错误消息。

Updating service api_backend (id: r4gqmil66kehzf0oehzqk57on)
 image registry.gitlab.com/my-group/my-project:staging could not be accessed on a registry to record
 its digest. Each node will access registry.gitlab.com/my-group/my-project:staging independently,
 possibly leading to different nodes running different
 versions of the image.

此外,gitlab运行程序还在Shell模式下执行命令。 我尝试了不同的解决方案,您可以看到我什至使用--with-registry-auth标志。

总结一下: 如果我手动输入代码,一切都会正常,但是使用gitlab-ci.yml时出现错误。

0 个答案:

没有答案