简体   繁体   English

Kubernetes BuildConfig 错误:拉取镜像失败

[英]Kubernetes BuildConfig error: failed to pull image

I'm trying to create a BuildConfig to automatically build a docker image and store it to the GitLab docker registry.我正在尝试创建一个 BuildConfig 来自动构建一个 docker 映像并将其存储到 GitLab docker 注册表中。

buildconfig.yaml buildconfig.yaml

kind: "BuildConfig"
apiVersion: "v1"
metadata:
  name: "tracker-build" 
spec:
  runPolicy: "Serial" 
  triggers: 
    -
      type: "GitLab"
      gitlab:
        secretReference:
           name: "webhooksecret"
  source: 
    git:
      uri: "https://gitlab.com/USERNAME/rayan_tracker_paas.git"
    sourceSecret:
      name: gitsecret
  strategy: 
    dockerStrategy:
      forcePull: true 
  output:
    to:
      kind: "DockerImage"
      name: "registry.gitlab.com/UESRNAME/rayan_tracker_paas:latest"
    pushSecret:
      name: "gitlab-reg"      
  resources:
    limits:
      cpu: 1500m
      ephemeral-storage: 1G
      memory: 600M
    requests:
      cpu: 1500m
      ephemeral-storage: 1G
      memory: 600M

After I starting it, I get this error:启动后,我收到此错误:

Pulling image node:12... error: build error: failed to pull image: toomanyrequests: You have reached your pull rate limit.正在拉取图像节点:12... 错误:构建错误:无法拉取图像:toomanyrequests:您已达到拉取速率限制。 You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit您可以通过认证升级来增加限制: https://www.docker.com/increase-rate-limit

The rate limits of 100 container image requests per six hours for anonymous usage, and 200 container image requests per six hours for free Docker accounts are now in effect.匿名使用每六小时 100 个容器映像请求的速率限制以及免费 Docker 帐户每六小时 200 个容器映像请求的速率限制现已生效。 Image requests exceeding these limits will be denied until the six hour window elapses.超过这些限制的图像请求将被拒绝,直到 6 小时 window 过去。

Since my application needs nodejs, it trying to pull node official image from docker hub and occur this problem.由于我的应用程序需要 nodejs,它试图从 docker 集线器中提取节点官方图像并出现此问题。 To solve this problem I need to use docker secret somewhere in buildconfig.yaml file which I couldn't find out by searching in google.为了解决这个问题,我需要在 buildconfig.yaml 文件中的某处使用 docker 机密,我无法通过在谷歌中搜索找到。

Finally, I find the solution.最后,我找到了解决方案。 I added pullSecret property to the strategy.dockerStrategy block.我在strategy.dockerStrategy块中添加了pullSecret属性。

strategy:
  dockerStrategy:
    forcePull: true 
    pullSecret:
      name:
        docker-hub

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

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