{
  "schema_version": "1.0",
  "id": "T-1a48cf0bd8fd",
  "url": "https://gpuatlas.top/articles/T-1a48cf0bd8fd/",
  "title": "Docker 里面看不到 GPU，应该检查哪几步？",
  "summary": "Docker无GPU按宿主驱动、运行时传入和镜像框架三层检查，设备查询与真实CUDA运算分别验证。",
  "language": "zh-Hans",
  "category": {
    "id": "c-06",
    "name": "部署与故障",
    "url": "https://gpuatlas.top/categories/c-06/"
  },
  "topics": [],
  "body_text": "Docker里看不到GPU，先按宿主、容器运行时、镜像框架三层定位。宿主nvidia-smi正常只说明驱动可查询设备，不代表已经传给容器，更不代表模型执行通过。\n\n先确认宿主驱动与设备，失败时换镜像通常无效；正常再核对NVIDIA Container Toolkit和运行时配置。容器启动要请求并允许目标GPU，实际使用的服务配置与新运行时也需确认。\n\n记录容器启动参数、设备选择和具体镜像标识，别只看可变标签。修改运行时后，已有容器是否需要按部署方式重新创建或启动，应按对应说明处理，不默认老进程自动获得新设备。\n\n设备可查询后，再检查镜像中的PyTorch或其他框架构建，CPU包不会因系统有Toolkit自动变GPU版。先官方最小设备测试，再小型CUDA张量，最后目标模型，逐层缩小变量。\n\n容器内不应把随意安装宿主内核驱动当成起点，先找清设备在哪一层不可见。宿主正常、容器查不到时检查运行时与启动配置；容器可查、框架不能用时再查镜像构建。修复对应一层后，用原模型实际运行，保留宿主驱动、运行时和镜像标识，避免下次被可变标签混淆。",
  "published_at": null,
  "modified_at": "2026-11-26T15:17:38.690397+00:00",
  "evidence": {
    "type": "documentation_and_conditional_estimates",
    "hardware_tested": false,
    "note": "资料解释与条件估算，非硬件实测。"
  },
  "sources": [
    {
      "id": "nvidia-container-toolkit",
      "url": "https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html",
      "retrieved_at": "2026-11-25T10:24:21.873697+00:00"
    },
    {
      "id": "torch-cuda",
      "url": "https://docs.pytorch.org/docs/2.15/cuda.html",
      "retrieved_at": "2026-11-25T10:24:21.873697+00:00"
    },
    {
      "id": "cuda-compatibility",
      "url": "https://docs.nvidia.com/deploy/cuda-compatibility/index.html",
      "retrieved_at": "2026-11-25T10:24:21.873697+00:00"
    }
  ],
  "revision_note": "完善阅读结构；非硬件实测。",
  "representations": {
    "html": "https://gpuatlas.top/articles/T-1a48cf0bd8fd/",
    "json": "https://gpuatlas.top/data/articles/T-1a48cf0bd8fd.json",
    "markdown": "https://gpuatlas.top/data/articles/T-1a48cf0bd8fd.md"
  }
}
