
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
NVIDIA DCGM Exporter是一款基于NVIDIA Data Center GPU Manager (DCGM) 的Prometheus指标导出器,用于收集和暴露NVIDIA GPU的关键性能指标。该Docker镜像封装了DCGM Exporter的运行环境,可快速部署在包含NVIDIA GPU的服务器或容器化环境中,实现对GPU的实时监控与指标采集,供Prometheus抓取并集成到监控系统(如Grafana)中进行可视化分析。
bashdocker run -d \ --name dcgm-exporter \ --gpus all \ --restart always \ -p 9400:9400 \ -v /etc/localtime:/etc/localtime:ro \ ***-nvcr.xuanyuan.run/nvidia/k8s/dcgm-exporter:latest
参数说明:
--gpus all:授予容器访问所有GPU设备的权限(需nvidia-container-toolkit支持)。-p 9400:9400:映射容器内DCGM Exporter默认端口(9400)到主机,供Prometheus抓取指标。-v /etc/localtime:/etc/localtime:ro:同步容器与主机时间,确保指标时间戳准确。创建docker-compose.yml文件:
yamlversion: '3.8' services: dcgm-exporter: image: ***-nvcr.xuanyuan.run/nvidia/k8s/dcgm-exporter:latest container_name: dcgm-exporter restart: always deploy: resources: reservations: devices: - driver: nvidia count: all capabilities: [gpu] ports: - "9400:9400" volumes: - /etc/localtime:/etc/localtime:ro # 可选:挂载自定义配置文件 # - ./dcgm-exporter.yaml:/etc/dcgm-exporter/dcgm-exporter.yaml environment: - DCGM_EXPORTER_PORT=9400 # 可选,指定暴露端口(默认9400) # 可选:指定自定义收集器配置 # - DCGM_EXPORTER_CONFIG=/etc/dcgm-exporter/dcgm-exporter.yaml
启动服务:
bashdocker-compose up -d
4.4.1 环境变量
| 环境变量名 | 描述 | 默认值 |
|---|---|---|
DCGM_EXPORTER_PORT | 指标暴露端口 | 9400 |
DCGM_EXPORTER_COLLECTORS | 指定预定义收集器集合(如default、extended),多个集合用逗号分隔 | default |
DCGM_EXPORTER_CONFIG | 自定义收集器配置文件路径(需通过卷挂载到容器内) | /etc/dcgm-exporter/dcgm-exporter.yaml |
4.4.2 配置文件
通过挂载自定义配置文件(dcgm-exporter.yaml)可定义采集指标类型、频率等。示例配置:
yamlcollectors: - name: gpu_utilization metric_name: dcgm_gpu_utilization type: gauge help: "GPU utilization percentage" dcgm_field: DCGM_FI_DEV_GPU_UTIL - name: memory_used metric_name: dcgm_memory_used type: gauge help: "Memory used in bytes" dcgm_field: DCGM_FI_DEV_MEM_USED
(完整字段列表参考https://docs.nvidia.com/datacenter/dcgm/latest/dcgm-api/dcgm-field-ids.html%EF%BC%89
部署后,可通过以下命令验证指标是否正常暴露:
bashcurl http://localhost:9400/metrics
返回结果应包含类似以下的Prometheus格式指标:
# HELP dcgm_gpu_utilization GPU utilization percentage # TYPE dcgm_gpu_utilization gauge dcgm_gpu_utilization{gpu="0",uuid="GPU-xxx"} 25 # HELP dcgm_memory_used Memory used in bytes # TYPE dcgm_memory_used gauge dcgm_memory_used{gpu="0",uuid="GPU-xxx"} 4294967296
下载并使用本镜像即表示您同意遵守镜像中包含的NVIDIA软件的许可协议条款。具体许可条款可参考NVIDIA官方文档或镜像拉取时的附加说明。
以下是 nvidia/dcgm-exporter 相关的常用 Docker 镜像,适用于 不同场景 等不同场景:
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务