【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

相关推荐
啾啾Fun1 小时前
【AI Coding】5-Pi Agent Harness:一个极简终端编码Harness的解构
人工智能·microsoft·ai agent·claude code·ai coding
桂云网络OSG1 小时前
桂花AI引擎,广西本土自研的企业级 Agent 编排引擎发布:不聊参数,聊工程落地
人工智能
WX _ jishuwu19901 小时前
esmfold gpu模式 批量预测蛋白三级结构实况记录 - 供参考
人工智能·ubuntu·三代测序·亚细胞定位,·deeploc·protcompv9
LuiChun1 小时前
与精神病患者的日常探讨20260913
docker
闲云野鹤在人间1 小时前
Docker入门|第1章 容器生态系统完整解析
运维·服务器·docker·容器·centos
Nablai1 小时前
从供应链与合规看:AI 玩具为何需要多芯片路线
人工智能
王清欢Randy1 小时前
AI 时代的 “黑客与画家”
人工智能·程序人生·ai编程·程序员技能
鲜于言悠9051 小时前
告别AI界面翻车!深度拆解MCP Apps与A2UI两套生成式UI协议
人工智能
大模型码小白1 小时前
数据可视化:AI 生成 HTML5 动态交互式数据图表
前端·数据库·人工智能·深度学习·机器学习·信息可视化·html5
明月_清风2 小时前
本体论和本体建模的具体应用场景究竟是什么?
人工智能·后端