{
  "id": "docker/cgroup-memory-limit-exceeded-for-process",
  "signature": "docker: Error response from daemon: OCI runtime create failed: cgroup memory limit exceeded for process init",
  "signature_zh": "docker：守护进程响应错误：OCI 运行时创建失败：进程 init 的 cgroup 内存限制已超出",
  "regex": "oci runtime create failed: cgroup memory limit exceeded for process init",
  "domain": "docker",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "The container's memory limit set via --memory or docker-compose mem_limit is too low for the initial process allocation, causing the OOM killer to terminate the container immediately on start.",
  "root_cause_type": "generic",
  "root_cause_zh": "通过 --memory 或 docker-compose mem_limit 设置的容器内存限制过低，无法满足初始进程的内存分配，导致 OOM 杀手在启动时立即终止容器。",
  "versions": [
    {
      "version": "Docker 20.10.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Docker 24.0.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "containerd 1.6.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "If the container's process requires more memory than the increased limit (e.g., 256MB for a Node.js app), a small increment may still be insufficient, causing the same error.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "While this avoids the error, it removes resource constraints, potentially causing host instability if the container consumes excessive memory.",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The error occurs at runtime initialization, not during build; the base image size does not affect the process's memory allocation at start time.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check the container's baseline memory usage by running it without memory limits temporarily using 'docker run --rm <image> free -m' or 'docker stats', then set --memory to at least 1.5x that value. For example, if baseline is 200MB, use '--memory=300m'.",
      "success_rate": 0.9,
      "how": "Check the container's baseline memory usage by running it without memory limits temporarily using 'docker run --rm <image> free -m' or 'docker stats', then set --memory to at least 1.5x that value. For example, if baseline is 200MB, use '--memory=300m'.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using docker-compose, add 'mem_limit: 512m' or higher in the service definition, and also set 'mem_reservation: 256m' to ensure minimum memory availability.",
      "success_rate": 0.85,
      "how": "If using docker-compose, add 'mem_limit: 512m' or higher in the service definition, and also set 'mem_reservation: 256m' to ensure minimum memory availability.",
      "condition": "",
      "sources": []
    },
    {
      "action": "For containers with high memory spikes on startup (e.g., Java apps), use '--memory-swap' to allow swap space. Example: 'docker run --memory=256m --memory-swap=512m <image>'.",
      "success_rate": 0.8,
      "how": "For containers with high memory spikes on startup (e.g., Java apps), use '--memory-swap' to allow swap space. Example: 'docker run --memory=256m --memory-swap=512m <image>'.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "临时运行容器而不设置内存限制，使用 'docker run --rm <image> free -m' 或 'docker stats' 检查基线内存使用量，然后将 --memory 设置为至少 1.5 倍。例如，如果基线为 200MB，使用 '--memory=300m'。",
    "如果使用 docker-compose，在服务定义中添加 'mem_limit: 512m' 或更高，并设置 'mem_reservation: 256m' 以确保最小内存可用性。",
    "对于启动时内存峰值高的容器（例如 Java 应用），使用 '--memory-swap' 允许交换空间。示例：'docker run --memory=256m --memory-swap=512m <image>'。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.docker.com/config/containers/resource_constraints/#memory",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-06-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}