{
  "id": "docker/container-exited-139-segfault",
  "signature": "Container exited with code 139 (segfault)",
  "signature_zh": "容器以代码 139 退出（段错误）",
  "regex": "Container exited with code 139",
  "domain": "docker",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The application inside the container crashed due to a segmentation fault, often caused by memory access violations, stack overflow, or incompatible shared libraries.",
  "root_cause_type": "generic",
  "root_cause_zh": "容器内应用程序因段错误崩溃，通常由内存访问违规、栈溢出或不兼容的共享库引起。",
  "versions": [
    {
      "version": "Docker 24.0.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Linux 5.10.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "glibc 2.35",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase container memory limit with --memory",
      "why_fails": "Segfault is often not due to memory limit; increasing memory may mask the issue but not fix the root cause.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Rebuild the image with --no-cache",
      "why_fails": "Cache invalidation does not fix application logic errors or library incompatibilities.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Run container with --security-opt seccomp=unconfined",
      "why_fails": "Unconfined seccomp may allow more syscalls but does not prevent segfaults from application bugs.",
      "fail_rate": 0.55,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Enable core dumps inside the container: add '--ulimit core=-1' and mount a volume for core files: 'docker run --ulimit core=-1 -v /tmp/cores:/cores myapp'. Then analyze with gdb: 'gdb /path/to/binary /cores/core'.",
      "success_rate": 0.8,
      "how": "Enable core dumps inside the container: add '--ulimit core=-1' and mount a volume for core files: 'docker run --ulimit core=-1 -v /tmp/cores:/cores myapp'. Then analyze with gdb: 'gdb /path/to/binary /cores/core'.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check for incompatible shared libraries: run 'ldd /usr/bin/myapp' inside the container. If any library is 'not found', rebuild the image with correct library versions.",
      "success_rate": 0.75,
      "how": "Check for incompatible shared libraries: run 'ldd /usr/bin/myapp' inside the container. If any library is 'not found', rebuild the image with correct library versions.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在容器内启用核心转储：添加 '--ulimit core=-1' 并挂载卷以存储核心文件：'docker run --ulimit core=-1 -v /tmp/cores:/cores myapp'。然后使用 gdb 分析：'gdb /path/to/binary /cores/core'。",
    "检查不兼容的共享库：在容器内运行 'ldd /usr/bin/myapp'。如果任何库显示 'not found'，使用正确的库版本重建镜像。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.docker.com/engine/reference/commandline/run/#exit-status",
  "official_doc_section": null,
  "error_code": "139",
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.72,
  "resolvable": "partial",
  "first_seen": "2023-08-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}