GitLab CI构建失败:无法获取Docker镜像内容描述符
GitLab CI 镜像拉取失败问题排查
环境参数
- 运行器:GitLab.com 共享运行器
- 访问令牌:已激活
- 远程仓库(另一GitLab.com仓库):正常可用
- 远程Docker镜像:已存在
问题描述
2小时前构建一切正常,现在出现以下错误:
#1 [internal] load .dockerignore #1 transferring context: 2B done #1 DONE 0.0s #2 [internal] load build definition from Dockerfile #2 transferring dockerfile: 462B done #2 DONE 0.1s #3 [internal] load metadata for registry.gitlab.com/my_profile/nginx... #3 ERROR: failed to copy: httpReadSeeker: failed open: could not fetch content descriptor sha256:acfa0a241e8726b03df9ef0765ecddda7588cbc751cb07b53ac999046297dbda (application/vnd.docker.container.image.v1+json) from remote: not found ------ > [internal] load metadata for registry.gitlab.com/my_profile/nginx-php:php-8.1: ------ registry.gitlab.com/my_profile/nginx-php:php-8.1: failed to copy: httpReadSeeker: failed open: could not fetch content descriptor sha256:acfa0a241e8726b03df9ef0765ecddda7588cbc751cb07b53ac999046297dbda (application/vnd.docker.container.image.v1+json) from remote: not found Cleaning up project directory and file based variables 00:01 ERROR: Job failed: exit code 1
排查建议
检查镜像标签与哈希一致性
确认registry.gitlab.com/my_profile/nginx-php:php-8.1标签是否被重新推送过,导致原哈希sha256:acfa0a241e8726b03df9ef0765ecddda7588cbc751cb07b53ac999046297dbda对应的镜像被删除或替换。可直接用镜像哈希拉取测试:docker pull registry.gitlab.com/my_profile/nginx-php@sha256:acfa0a241e8726b03df9ef0765ecddda7588cbc751cb07b53ac999046297dbda验证GitLab容器仓库权限
确认访问令牌拥有该镜像仓库的读取权限,且未过期或被撤销。可在本地用该令牌登录仓库测试拉取:docker login registry.gitlab.com -u <用户名> -p <访问令牌> docker pull registry.gitlab.com/my_profile/nginx-php:php-8.1排查共享运行器网络问题
GitLab.com共享运行器可能存在临时网络波动,尝试重新触发CI构建,或切换至其他可用的共享运行器(若有选项)。强制刷新镜像元数据缓存
在CI配置中添加--no-cache参数,强制Docker重新拉取镜像元数据,避免缓存旧数据导致的问题:script: - docker build --no-cache -t <目标镜像名> .
内容的提问来源于stack exchange,提问作者Arkadiusz G.
相关产品推荐
相关产品推荐

