更新时间:2025-12-05 GMT+08:00
构建时拉取dockerhub镜像超时/次数限制
问题现象
执行构建任务时,拉取dockerhub镜像超时/次数限制,日志报如下异常信息:
Error response from daemon: Get https://registry.docker-cn.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
或
toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
原因分析
可能是因为dockerhub镜像源的网络不稳定并且存在频率限制,容易导致拉取超时或失败。可以将dockerhub镜像源的镜像迁移到SWR上,再拉取镜像。
处理方法
- 使用docker pull命令,下载dockerhub镜像源的镜像到本地。操作方法可参考通过Docker命令操作镜像。
- 参考页面上传镜像页面,上传镜像到SWR。
- 在镜像详情页面中,单击对应镜像版本“下载指令”列的复制图标
,复制镜像下载指令。

- 修改代码仓中Dockerfile文件,将文件中镜像地址修改为步骤3中拷贝的地址。

父主题: 镜像问题