{
  "id": "docker/container-exit-code-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": "A process inside the container attempted to access memory it was not allowed to, often due to incompatible binary architecture, corrupted memory, or insufficient memory limits.",
  "root_cause_type": "generic",
  "root_cause_zh": "容器内的进程尝试访问不允许的内存，通常由于不兼容的二进制架构、内存损坏或内存限制不足。",
  "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": "Alpine 3.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "docker run -m 2g your_image",
      "why_fails": "Increasing memory limit alone does not fix the underlying segfault cause.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "docker build --no-cache -t your_image .",
      "why_fails": "Rebuilding the image without fixing architecture mismatch still produces the same binary.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "docker run --user root your_image",
      "why_fails": "Running as root does not prevent segfaults caused by memory corruption.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check binary architecture compatibility: run 'file /path/to/binary' inside container. If mismatch, rebuild for correct architecture (e.g., use --platform linux/amd64).",
      "success_rate": 0.85,
      "how": "Check binary architecture compatibility: run 'file /path/to/binary' inside container. If mismatch, rebuild for correct architecture (e.g., use --platform linux/amd64).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase memory limit and add swap: docker run -m 512m --memory-swap 1g your_image",
      "success_rate": 0.65,
      "how": "Increase memory limit and add swap: docker run -m 512m --memory-swap 1g your_image",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using gdb or valgrind, debug the segfault: docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined your_image gdb /path/to/binary",
      "success_rate": 0.7,
      "how": "If using gdb or valgrind, debug the segfault: docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined your_image gdb /path/to/binary",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Check binary architecture compatibility: run 'file /path/to/binary' inside container. If mismatch, rebuild for correct architecture (e.g., use --platform linux/amd64).",
    "Increase memory limit and add swap: docker run -m 512m --memory-swap 1g your_image",
    "If using gdb or valgrind, debug the segfault: docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined your_image gdb /path/to/binary"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.docker.com/engine/reference/run/#exit-status",
  "official_doc_section": null,
  "error_code": "139",
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.7,
  "resolvable": "partial",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}