【AI】10卡的GPU服务器,Docker 配置 docker-compose.yml 限制指定使用最后两块GPU 序号8,9

GPU状态

复制代码
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 570.86.10              Driver Version: 570.86.10      CUDA Version: 12.8     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 4090        Off |   00000000:0C:00.0 Off |                  Off |
| 30%   26C    P8             18W /  450W |   23393MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   1  NVIDIA GeForce RTX 4090        Off |   00000000:25:00.0 Off |                  Off |
| 30%   27C    P8             28W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   2  NVIDIA GeForce RTX 4090        Off |   00000000:32:00.0 Off |                  Off |
| 30%   27C    P8              6W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   3  NVIDIA GeForce RTX 4090        Off |   00000000:45:00.0 Off |                  Off |
| 30%   27C    P8             18W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   4  NVIDIA GeForce RTX 4090        Off |   00000000:58:00.0 Off |                  Off |
| 30%   28C    P8             24W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   5  NVIDIA GeForce RTX 4090        Off |   00000000:84:00.0 Off |                  Off |
| 30%   27C    P8             21W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   6  NVIDIA GeForce RTX 4090        Off |   00000000:98:00.0 Off |                  Off |
| 30%   26C    P8             16W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   7  NVIDIA GeForce RTX 4090        Off |   00000000:AC:00.0 Off |                  Off |
| 30%   28C    P8             27W /  450W |   23703MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   8  NVIDIA GeForce RTX 4090        Off |   00000000:C0:00.0 Off |                  Off |
| 30%   27C    P8             22W /  450W |     439MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
|   9  NVIDIA GeForce RTX 4090        Off |   00000000:D4:00.0 Off |                  Off |
| 30%   25C    P8             22W /  450W |       4MiB /  24564MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

配置docker-compose.yml

services:

ragflow:

environment:

  • NVIDIA_VISIBLE_DEVICES=0,1 # 内部序号还是0,1 不是外部的8,9

deploy:

resources:

reservations:

devices:

  • driver: nvidia

device_ids: ["8","9"]

capabilities: [gpu]

注意:

  1. 内部环境变量仍然是0,1

  2. device_ids参数是字符串数组,不是整形数组

效果:

docker exec -it ragflow-server nvidia-smi

Thu Mar 27 00:23:16 2025

+-----------------------------------------------------------------------------------------+

| NVIDIA-SMI 570.86.10 Driver Version: 570.86.10 CUDA Version: 12.8 |

|-----------------------------------------+------------------------+----------------------+

| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |

| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |

| | | MIG M. |

|=========================================+========================+======================|

| 0 NVIDIA GeForce RTX 4090 Off | 00000000:C0:00.0 Off | Off |

| 30% 25C P8 22W / 450W | 439MiB / 24564MiB | 0% Default |

| | | N/A |

+-----------------------------------------+------------------------+----------------------+

| 1 NVIDIA GeForce RTX 4090 Off | 00000000:D4:00.0 Off | Off |

| 30% 23C P8 22W / 450W | 4MiB / 24564MiB | 0% Default |

| | | N/A |

+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+

| Processes: |

| GPU GI CI PID Type Process name GPU Memory |

| ID ID Usage |

|=========================================================================================|

| 0 N/A N/A 18 C python3 430MiB |

+-----------------------------------------------------------------------------------------+

观察GPU内存,可以确认容器内部是使用末尾的两块GPU

相关推荐
龙山云仓20 分钟前
小G&老D求解:第7日·立夏·蝼蝈鸣
人工智能·机器学习
LaughingZhu31 分钟前
Product Hunt 每日热榜 | 2026-04-30
人工智能·经验分享·深度学习·神经网络·产品运营
sunneo37 分钟前
专栏D-团队与组织-03-产品文化
人工智能·产品运营·aigc·产品经理·ai编程
Muyuan199837 分钟前
28.Paper RAG Agent 开发记录:修复 LLM Rerank 的解析、Fallback 与可验证性
linux·人工智能·windows·python·django·fastapi
小呆呆6661 小时前
Codex 穷鬼大救星
前端·人工智能·后端
薛定猫AI1 小时前
【深度解析】Kimi K2.6 的长上下文 Agentic Coding 能力与 OpenAI 兼容 API 接入实践
人工智能·自动化·知识图谱
星爷AG I1 小时前
20-6 记忆整合(AGI基础理论)
人工智能·agi
AI创界者1 小时前
人工智能 GPT-Image DMXAPI Python AI绘画
人工智能
播播资源1 小时前
GPT-5.5 模型功能深度解析:从模型介绍、核心特点到应用场景全景分析 如何快速接入使用
人工智能·gpt
谁似人间西林客1 小时前
工厂大脑是什么?从经验驱动到AI辅助的决策跃迁
人工智能