{
  "id": "cicd/docker-build-oom-killed",
  "signature": "Killed - The build process was terminated due to out of memory. Try increasing the memory limit.",
  "signature_zh": "已终止 - 构建进程因内存不足而被终止。请尝试增加内存限制。",
  "regex": "Killed.*out of memory|OOM killer|oom-killed",
  "domain": "cicd",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "The Docker build process exceeds the available memory on the runner or host, often due to large multi-stage builds, heavy compilation steps, or insufficient resource allocation in CI.",
  "root_cause_type": "generic",
  "root_cause_zh": "Docker 构建过程超过了运行器或主机上的可用内存，通常是由于大型多阶段构建、繁重的编译步骤或 CI 中资源分配不足。",
  "versions": [
    {
      "version": "Docker 24.0.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Docker 25.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "GitHub Actions runner v2.315.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Adding more RUN layers without combining them; each layer creates additional intermediate containers that increase memory pressure.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Removing --memory flag entirely thinking it's restrictive; the default limit might be too low, but removing it doesn't increase available memory.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Ignoring the error and retrying; the build will likely fail again at the same point unless memory is increased or the Dockerfile is optimized.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Increase the memory limit in the CI configuration (e.g., GitHub Actions: `options: --memory=8g` in the job definition, or Docker Compose: `mem_limit: 8g`).",
      "success_rate": 0.8,
      "how": "Increase the memory limit in the CI configuration (e.g., GitHub Actions: `options: --memory=8g` in the job definition, or Docker Compose: `mem_limit: 8g`).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Optimize the Dockerfile by combining RUN commands: `RUN apt-get update && apt-get install -y package1 package2 && apt-get clean` to reduce layer count and intermediate storage.",
      "success_rate": 0.75,
      "how": "Optimize the Dockerfile by combining RUN commands: `RUN apt-get update && apt-get install -y package1 package2 && apt-get clean` to reduce layer count and intermediate storage.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a multi-stage build with a slim base image (e.g., `FROM node:18-alpine` instead of `FROM node:18`) to reduce memory footprint during build.",
      "success_rate": 0.7,
      "how": "Use a multi-stage build with a slim base image (e.g., `FROM node:18-alpine` instead of `FROM node:18`) to reduce memory footprint during build.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在 CI 配置中增加内存限制（例如 GitHub Actions：在作业定义中添加 `options: --memory=8g`，或 Docker Compose：`mem_limit: 8g`）。",
    "通过合并 RUN 命令优化 Dockerfile：`RUN apt-get update && apt-get install -y package1 package2 && apt-get clean` 以减少层数和中间存储。",
    "使用多阶段构建和精简基础镜像（例如 `FROM node:18-alpine` 代替 `FROM node:18`）以减少构建期间的内存占用。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.docker.com/config/containers/resource_constraints/",
  "official_doc_section": null,
  "error_code": "OOM_KILLED",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.78,
  "resolvable": "true",
  "first_seen": "2024-01-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}