{
  "id": "docker/exec-format-error-arm64",
  "signature": "exec /usr/bin/python3: exec format error",
  "signature_zh": "执行 /usr/bin/python3：执行格式错误",
  "regex": "exec .*: exec format error",
  "domain": "docker",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "The container image is built for a different CPU architecture (e.g., amd64) than the host (e.g., arm64), causing the binary's ELF format to be incompatible.",
  "root_cause_type": "generic",
  "root_cause_zh": "容器镜像是为不同 CPU 架构（如 amd64）构建的，而宿主是 arm64，导致二进制文件的 ELF 格式不兼容。",
  "versions": [
    {
      "version": "Docker 25.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "containerd 1.7.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Linux 6.5.0-arm64",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Reinstall Docker on the host",
      "why_fails": "Reinstallation does not change the CPU architecture mismatch between image and host.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Add '--platform linux/amd64' to docker run",
      "why_fails": "Forcing amd64 on an arm64 host without binfmt_misc or QEMU setup will still fail if the binary is not emulated.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Update Python inside the container via pip",
      "why_fails": "The error is at the binary execution level, not Python version; pip cannot fix ELF format.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Pull the correct architecture image: 'docker pull --platform linux/arm64 python:3.12-slim'. For multi-arch builds, use 'docker buildx build --platform linux/arm64 -t myapp .'",
      "success_rate": 0.95,
      "how": "Pull the correct architecture image: 'docker pull --platform linux/arm64 python:3.12-slim'. For multi-arch builds, use 'docker buildx build --platform linux/arm64 -t myapp .'",
      "condition": "",
      "sources": []
    },
    {
      "action": "Install QEMU user static binaries for emulation: 'docker run --privileged --rm tonistiigi/binfmt --install all'. Then run the amd64 image with 'docker run --platform linux/amd64 ...'",
      "success_rate": 0.85,
      "how": "Install QEMU user static binaries for emulation: 'docker run --privileged --rm tonistiigi/binfmt --install all'. Then run the amd64 image with 'docker run --platform linux/amd64 ...'",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "拉取正确架构的镜像：'docker pull --platform linux/arm64 python:3.12-slim'。对于多架构构建，使用 'docker buildx build --platform linux/arm64 -t myapp .'",
    "安装 QEMU 用户静态二进制文件以支持模拟：'docker run --privileged --rm tonistiigi/binfmt --install all'。然后使用 'docker run --platform linux/amd64 ...' 运行 amd64 镜像。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.docker.com/build/building/multi-platform/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2024-01-22",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}