Gitlab管道失败:错误:准备失败:来自守护进程的错误响应:toomanyrequests
Posted
技术标签:
【中文标题】Gitlab管道失败:错误:准备失败:来自守护进程的错误响应:toomanyrequests【英文标题】:Gitlab pipeline failed : ERROR: Preparation failed: Error response from daemon: toomanyrequests 【发布时间】:2021-02-23 02:48:43 【问题描述】:我有 Harbor
本地 docker 注册表,所有需要的图像都在那里,并将 GitLab 连接到 Harbor,所有图像都是从 Harbor 接收到的,但是在 11 月 2 日之后,Docker 限制了拉取的数量,看起来很不错服务从 Docker 中心拉取。
是否可以使用dind服务从Harbor拉出?
管道输出:
Running with gitlab-runner 12.10.1 (ce065b93)
on docker_runner_7 WykGNjC6
Preparing the "docker" executor
30:20
Using Docker executor with image **harbor**.XXX.XXXX.net/library/docker_maven_jvm14 ...
Starting service docker:**dind** ...
**Pulling docker image docker:dind** ...
**ERROR**: Preparation failed: Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit (docker.go:198:2s)
Will be retried in 3s ...
Using Docker executor with image harbor.XXX.XXX.net/library/docker_maven_jvm14 ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
ERROR: Preparation failed: Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit (docker.go:198:4s)
Will be retried in 3s ...
Using Docker executor with image harbor.XXX.XXX.net/library/docker_maven_jvm14 ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
ERROR: Preparation failed: Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit (docker.go:198:3s)
Will be retried in 3s ...
ERROR: Job failed (system failure): Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit (docker.go:198:3s)
【问题讨论】:
【参考方案1】:另一种方式:
如果不想添加daemon.json
,可以这样做:
-
从 docker hub 拉取 docker-dind
docker pull docker:stable-dind
-
登录港口
docker login harbor.XXX.com
-
标记图像到港口
docker tag docker:stable-dind harbor.XXX.com/library/docker:stable-dind
-
推进港口
docker push harbor.XXX.com/library/docker:stable-dind
转到.gitlab-ci.yml
而不是
services:
- docker:dind
写:
services:
- name: harbor.XXX.com/library/docker:stable-dind
alias: docker
我的.gitlab-ci.yml
:
stages:
- build_and_push
Build:
image: $DOCKER_REGISTRY/library/docker:ci_tools
stage: build_and_push
tags:
- dind
services:
- name: $DOCKER_REGISTRY/library/docker:stable-dind
alias: docker
script:
- docker login -u $DOCKER_REGISTRY_USERNAME -p $DOCKER_REGISTRY_PASSWORD $DOCKER_REGISTRY
- make build test release REGISTRY=$DOCKER_REGISTRY/library/ TELEGRAF_DOWNLOAD_URL="https://storage.XXX.com/ops/packages/telegraf-1.15.3_linux_amd64.tar.gz" TELEGRAF_SHA256="85a1ee372fb06921d09a345641bba5f3488d2db59a3fafa06f3f8c876523801d"
【讨论】:
我也遇到了同样的问题,我没有使用 Harbor,而是使用了 GitLab Registry。创建了一个名为Docker
的新仓库并推送到那里。一切正常,感谢您提到的程序。【参考方案2】:
我找不到 Gitlab 的解决方案,但你可以告诉 docker 忽略 docker hub 注册表并转到本地注册表。
在/etc/docker/daemon.json
中添加daemon.json
,如果不存在,你可以简单地在路径中添加。
daemon.json
"registry-mirrors": ["https://harbor.XXX.com"]
sudo systemctl restart docker
【讨论】:
【参考方案3】:我在将一些微服务部署到 kube 集群时也遇到了同样的问题,这是我写的一篇博客,它提供了一种解决方法来优化部署工作流程:https://mailazy.com/blog/optimize-docker-pull-gitlab-pipelines/
【讨论】:
以上是关于Gitlab管道失败:错误:准备失败:来自守护进程的错误响应:toomanyrequests的主要内容,如果未能解决你的问题,请参考以下文章
来自守护进程的错误响应:解析 Dockerfile 失败:语法错误 - 在“RUN”中找不到 =。必须采用以下形式:name=value
Docker:来自守护进程的错误响应:OCI 运行时创建失败:container_linux.go:296:
Docker 构建失败 - 带有 GKE 的 Gitlab CI。无法通过 tcp://localhost:2375 连接到 Docker 守护程序。 docker 守护进程是不是正在运行?
来自守护进程的错误响应:registry.gitlab.com 存储库的拉取访问被拒绝或可能需要“docker login”