{
  "id": "docker/tar-file-too-large-for-layer",
  "signature": "failed to register layer: Error processing tar file(exit status 1): write /app/node_modules/.cache/...: no space left on device",
  "signature_zh": "注册层失败：处理 tar 文件时出错（退出状态 1）：写入 /app/node_modules/.cache/...：设备上没有剩余空间",
  "regex": "failed to register layer: Error processing tar file[^:]*: no space left on device",
  "domain": "docker",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "The Docker build context or intermediate layer contains a large file (e.g., node_modules cache) that exceeds the available disk space in the Docker storage driver (overlay2).",
  "root_cause_type": "generic",
  "root_cause_zh": "Docker 构建上下文或中间层包含一个大文件（例如 node_modules 缓存），超出了 Docker 存储驱动（overlay2）中的可用磁盘空间。",
  "versions": [
    {
      "version": "Docker Desktop 4.23.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Docker Engine 24.0.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "overlay2 storage driver",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Node.js 18.18.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "npm 10.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding more RAM to the Docker VM (Docker Desktop settings)",
      "why_fails": "RAM allocation does not affect disk space in the storage driver; the error is about disk space, not memory. Increasing RAM may help other issues but not this one.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Running 'docker system prune -a' to clean all unused data",
      "why_fails": "While pruning frees space, it does not prevent the build from generating large layers again; the error will recur if the same large file is in the context.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting 'DOCKER_BUILDKIT=0' to disable BuildKit",
      "why_fails": "Disabling BuildKit uses the legacy builder which has the same disk space limitation; it may even be more space-intensive due to less efficient caching.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add a .dockerignore file to exclude large directories like node_modules: '**/node_modules/**' and '**/.cache/**' to reduce the build context size.",
      "success_rate": 0.9,
      "how": "Add a .dockerignore file to exclude large directories like node_modules: '**/node_modules/**' and '**/.cache/**' to reduce the build context size.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase the disk image size in Docker Desktop: Settings > Resources > Advanced > Disk image size (e.g., from 64GB to 128GB). Then apply and restart Docker.",
      "success_rate": 0.8,
      "how": "Increase the disk image size in Docker Desktop: Settings > Resources > Advanced > Disk image size (e.g., from 64GB to 128GB). Then apply and restart Docker.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use multi-stage builds to copy only necessary artifacts: 'COPY --from=builder /app/dist /app' and avoid copying entire node_modules into the final stage.",
      "success_rate": 0.85,
      "how": "Use multi-stage builds to copy only necessary artifacts: 'COPY --from=builder /app/dist /app' and avoid copying entire node_modules into the final stage.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "添加 .dockerignore 文件以排除大型目录，如 node_modules：'**/node_modules/**' 和 '**/.cache/**'，以减少构建上下文大小。",
    "在 Docker Desktop 中增加磁盘映像大小：设置 > 资源 > 高级 > 磁盘映像大小（例如从 64GB 增加到 128GB）。然后应用并重启 Docker。",
    "使用多阶段构建，仅复制必要的工件：'COPY --from=builder /app/dist /app'，避免将整个 node_modules 复制到最终阶段。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.docker.com/engine/reference/commandline/builder_prune/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-09-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}