docker build_error ai_generated true

处理 tar 文件时出错(退出状态 1):tar 归档意外结束

Error processing tar file(exit status 1): unexpected end of tar archive

ID: docker/tar-stream-eof-unexpected

其他格式: JSON · Markdown 中文 · English
77%修复率
83%置信度
1证据数
2023-05-18首次发现

版本兼容性

版本状态引入弃用备注
Docker 20.10.18 active
Docker 24.0.2 active
Registry 2.8.1 active

根因分析

Docker 镜像中的层 tarball 损坏或截断,通常是由于拉取时的网络中断、上传到注册表不完整或磁盘 I/O 错误导致。

English

A layer tarball in the Docker image is corrupted or truncated, often due to network interruption during pull, incomplete upload to registry, or disk I/O errors.

generic

官方文档

https://docs.docker.com/engine/reference/commandline/save/

解决方案

  1. Delete the specific corrupted image layer: `docker rmi <image>:<tag>` and then re-pull the image from the registry with `docker pull <image>:<tag>`. If the error persists, the registry image itself is corrupted; push a fresh build.
  2. If the image is local, export and re-import: `docker save myimage:latest -o myimage.tar && docker rmi myimage:latest && docker load -i myimage.tar`. This can fix minor tar header corruption.

无效尝试

常见但无效的做法:

  1. 85% 失败

    Pruning removes all images and containers but does not repair the corrupted layer; the error will reappear when pulling the same image again from the same registry.

  2. 90% 失败

    The error is due to data corruption, not timeout; reducing concurrency does not fix the underlying tarball integrity issue.