You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

向私有镜像仓库推送Docker镜像时遭遇EOF错误求助

Docker私有镜像仓库推送失败,报错Patch请求EOF

问题描述

向私有镜像仓库registry.apprepo.app推送镜像registry.apprepo.app/app:1.22.3时出现EOF错误,此前该操作可正常执行。推送报错信息如下:

PS C:\Users\user\aplication> docker push registry.apprepo.app/app:1.22.3 
The push refers to repository [registry.apprepo.app/app]
f4ca70ea751f: Layer already exists
05e4cd1b24c1: Pushed 
1ed92f7e8e52: Pushed
f9cb3f1f1d3d: Layer already exists
f0fb842dea41: Layer already exists
c1cd5c8c68ef: Layer already exists
1d54586a1706: Layer already exists
1003ff723696: Layer already exists
f1417ff83b31: Layer already exists
Patch "http://registry.apprepo.app/v2/app/blobs/uploads/f3666007-df22-456e-b15d-094d0317e166": EOF

相关配置文件:

Dockerfile

FROM node:14 as build-stage

WORKDIR /app

COPY . .

ARG target_env

RUN npm install -g gulp-cli \
    && npm install \
    && npm run build:$target_env

FROM nginx:1.23.4-alpine-slim as deploy-stage

COPY --from=build-stage /app/dist/ /usr/share/nginx/html

COPY --from=build-stage /app/nginx/default.conf /etc/nginx/conf.d/default.conf

COPY --from=build-stage /app/scripts/config.env.sh ./config.env.sh

CMD  chmod +x config.env.sh && ./config.env.sh

Docker Compose

version: '3'

services:

  app:
    image: registry.apprepo.app/app:${APP_VERSION}
    build:
      context: ./
      args:
        target_env: docker
    env_file:
      - docker/.env
    ports:
      - "8081:80"

已尝试执行命令:

docker builder prune -af   

问题仍未解决。


排查与解决方法

1. 检查私有仓库状态与网络连通性

  • 测试仓库服务是否正常:执行curl http://registry.apprepo.app/v2/,返回{}或类似响应说明仓库运行正常。
  • 排查网络稳定性:EOF错误常因网络中断、超时导致,可切换网络环境(如有线替代无线),检查防火墙/代理是否拦截Docker推送请求。若仓库用HTTPS,确认本地Docker是否信任仓库证书(自签名证书需添加到Docker信任目录)。

2. 清理本地镜像缓存与未完成上传记录

  • 删除本地镜像后重新构建推送:
    docker rmi registry.apprepo.app/app:1.22.3
    docker-compose build --no-cache app
    docker push registry.apprepo.app/app:1.22.3
    
  • 清理Docker临时上传目录:Windows路径为C:\ProgramData\Docker\tmp,Linux为/var/lib/docker/tmp,删除目录内文件后重启Docker服务。

3. 校验镜像层完整性

  • 尝试拉取仓库中已有镜像层,确认是否损坏:
    docker pull registry.apprepo.app/app:1.22.3
    
    若拉取失败,说明仓库中对应镜像层损坏,需删除仓库内该镜像记录后重新推送。

4. 调整Docker上传超时与并发配置

  • 修改Docker配置文件(Windows:C:\ProgramData\Docker\config\daemon.json;Linux:/etc/docker/daemon.json),降低并发上传数并增加超时相关设置:
    {
      "max-concurrent-uploads": 2,
      "insecure-registries": ["registry.apprepo.app"]
    }
    
    保存后重启Docker服务,再尝试推送。

5. 检查仓库服务器磁盘空间与配额

  • 确认私有仓库所在服务器磁盘是否已满,或是否设置了镜像存储配额。磁盘空间不足会导致上传中断,触发EOF错误。

内容的提问来源于stack exchange,提问作者Limup

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 08:18:33