# 可用的 Docker 镜像

在 Clore.ai 租用 GPU 服务器时，您可以从预配置的 Docker 镜像中选择或使用自己的自定义镜像。

## Clore 官方镜像

由 Clore.ai 维护的预构建镜像，为去中心化 GPU 市场优化。

### 通用用途

| Docker 镜像                                 | 描述                                | 端口       | 更新于            |
| ----------------------------------------- | --------------------------------- | -------- | -------------- |
| `cloreai/jupyter:ubuntu24.04-v2`          | Ubuntu 24.04 上的 Jupyter Lab + SSH | 22, 8888 | 2025 年 1 月 ✅   |
| `cloreai/ml-tools:0.1`                    | Jupyter Lab + VS Code Web 服务器     | 22, 8888 | 2023 年 7 月 ⚠️  |
| `cloreai/ubuntu20.04-jupyter:latest`      | Ubuntu 20.04 + SSH + Jupyter      | 22, 8888 | 2022 年 11 月 ⚠️ |
| `cloreai/ubuntu-20.04-remote-desktop:1.2` | 带远程桌面 GUI 的 Ubuntu                | 22, 3389 | 2023 年 5 月 ⚠️  |
| `cloreai/torch:2.0.1`                     | PyTorch 2.0.1 + CUDA              | 22       | 2023 年 7 月 ⚠️  |

### AI/ML 推理

| Docker 镜像                               | 描述                     | 端口   | 更新于           |
| --------------------------------------- | ---------------------- | ---- | ------------- |
| `cloreai/deepseek-r1-8b:latest`         | DeepSeek R1 8B 即时可运行   | 8000 | 2025 年 1 月 ✅  |
| `cloreai/stable-diffusion-webui:latest` | AUTOMATIC1111 SD WebUI | 7860 | 2023 年 9 月 ⚠️ |
| `cloreai/oobabooga:1.5`                 | 文本生成 WebUI             | 7860 | 2023 年 8 月 ⚠️ |

### 基础设施与挖矿

| Docker 镜像                   | 描述          | 更新于           |
| --------------------------- | ----------- | ------------- |
| `cloreai/monitoring:0.7`    | 服务器监控代理     | 2024 年 9 月 ✅  |
| `cloreai/hiveos:0.4`        | HiveOS 集成   | 2025 年 2 月 ✅  |
| `cloreai/openvpn-proxy:0.2` | VPN/代理 转发   | 2025 年 2 月 ✅  |
| `cloreai/proxy:0.2`         | 端口转发系统      | 2024 年 1 月    |
| `cloreai/automining:0.1`    | 自动挖矿设置      | 2023 年 6 月 ⚠️ |
| `cloreai/kuzco:latest`      | Kuzco 分布式推理 | 2025 年 6 月 ✅  |
| `cloreai/partner:nastya-01` | 合作伙伴集成工具    | 2025 年 4 月 ✅  |

> ⚠️ 标记为 ⚠️ 的镜像超过一年未更新。对于 ML 工作负载，考虑使用 **社区镜像** 下面的镜像提供了更新的 CUDA 和框架版本。

## 推荐的社区镜像

来自更广泛 AI/ML 社区的实战镜像，具有积极维护和较新的版本。

### 深度学习框架

| 镜像                      | 标签                               | 描述                      | 使用场景           | 端口                |
| ----------------------- | -------------------------------- | ----------------------- | -------------- | ----------------- |
| `pytorch/pytorch`       | `2.10.0-cuda13.0-cudnn9-runtime` | 带 CUDA 13.0 的最新 PyTorch | 深度学习训练/推理      | 8888（Jupyter）     |
| `nvidia/cuda`           | `13.1.1-runtime-ubuntu22.04`     | NVIDIA CUDA 运行时         | 自定义 CUDA 应用    | -                 |
| `nvidia/cuda`           | `13.1.1-devel-ubuntu22.04`       | CUDA 开发工具               | 构建 CUDA 项目     | -                 |
| `tensorflow/tensorflow` | `2.15.0-gpu`                     | TensorFlow GPU 支持       | TensorFlow 工作流 | 8888（TensorBoard） |

### 大模型推理引擎

| 镜像                                              | 标签       | 描述               | 使用场景       | 端口    |
| ----------------------------------------------- | -------- | ---------------- | ---------- | ----- |
| `vllm/vllm-openai`                              | `latest` | 高性能大模型服务         | 生产级大模型 API | 8000  |
| `ghcr.io/huggingface/text-generation-inference` | `3.3.5`  | Hugging Face TGI | 企业级大模型服务   | 80    |
| `ollama/ollama`                                 | `latest` | 本地大模型运行器         | 本地/边缘大模型部署 | 11434 |

### 图像生成

| 镜像                                | 标签       | 描述                     | 使用场景    | 端口   |
| --------------------------------- | -------- | ---------------------- | ------- | ---- |
| `goolashe/automatic1111-sd-webui` | `latest` | Stable Diffusion WebUI | AI 艺术生成 | 7860 |
| `sinfallas/comfyui`               | `latest` | ComfyUI 节点式 SD         | 高级图像工作流 | 8188 |

### 开发环境

| 镜像                            | 标签                             | 描述                   | 使用场景   | 端口   |
| ----------------------------- | ------------------------------ | -------------------- | ------ | ---- |
| `jupyter/tensorflow-notebook` | `latest`                       | Jupyter + TensorFlow | ML 实验  | 8888 |
| `jupyter/pytorch-notebook`    | `latest`                       | Jupyter + PyTorch    | 深度学习研究 | 8888 |
| `cschranz/gpu-jupyter`        | `v1.10_cuda-12.9_ubuntu-24.04` | 启用 GPU 的 Jupyter     | GPU 计算 | 8888 |

## 选择镜像

### 通过网页界面

1. 前往 **市场** → 查找服务器 → **租用**
2. 在订单表单中，选择 **Docker 镜像** 从下拉菜单
3. 从预配置选项中选择或输入自定义镜像
4. 配置暴露的端口（逗号分隔： `8888,7860,8000`)
5. 如有需要，添加环境变量
6. 提交订单

### 通过 API

```json
{
  "image": "pytorch/pytorch:2.10.0-cuda13.0-cudnn9-runtime",
  "ports": [8888, 8000],
  "env": {
    "JUPYTER_ENABLE_LAB": "yes"
  }
}
```

## 自定义 Docker 镜像

### 支持的注册表

* **Docker Hub**: `username/image:tag`
* **GitHub 容器注册表**: `ghcr.io/user/image:tag`
* **NVIDIA NGC**: `nvcr.io/nvidia/image:tag`
* **Google 容器注册表**: `gcr.io/project/image:tag`

### 示例

```bash
# PyTorch 最新版，带 CUDA 12.1
pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime

# NVIDIA CUDA 基础镜像
nvidia/cuda:12.2.0-base-ubuntu22.04

# Hugging Face Transformers
huggingface/transformers-pytorch-gpu:4.35.0

# 自定义镜像
your-username/my-ai-model:v1.0
```

### 自定义镜像要求

* ✅ 必须可公开访问
* ✅ 应包含对 NVIDIA GPU 的支持以用于 GPU 实例
* ✅ 基于启用 CUDA 的镜像以获得 GPU 加速
* ✅ 包含必要的驱动程序和库
* ⚠️ 大型镜像（>10GB）可能需要更长的下载时间

## 端口配置

为您的应用暴露端口，以便从外部访问：

| 端口    | 常见用途                 | 框架                 |
| ----- | -------------------- | ------------------ |
| 22    | SSH 访问               | 系统                 |
| 8888  | Jupyter Notebook/Lab | Jupyter            |
| 7860  | Gradio 界面            | SD WebUI、Gradio 应用 |
| 8000  | API 服务器              | vLLM、FastAPI       |
| 3000  | Web 应用               | React、Node.js      |
| 8080  | HTTP 服务              | 通用 Web 服务          |
| 11434 | Ollama API           | Ollama             |
| 8188  | ComfyUI 界面           | ComfyUI            |

### 在订单表单中设置端口

```
8888,7860,8000
```

## 环境变量

向容器传递配置：

### 常见示例

```bash
# Hugging Face 令牌
HF_TOKEN=hf_your_token_here

# 模型配置
MODEL_NAME=meta-llama/Llama-2-7b-chat-hf
CUDA_VISIBLE_DEVICES=0

# Jupyter 配置
JUPYTER_ENABLE_LAB=yes
JUPYTER_TOKEN=your_secure_token

# vLLM 配置
VLLM_WORKER_MULTIPROC_METHOD=spawn
```

### 安全注意事项

* ❌ 不要将机密放入环境变量
* ✅ 使用临时令牌或 API 密钥
* ✅ 在可能的情况下将机密挂载为卷

## 持久存储

### 存储位置

* `/workspace` - 通常在租用期间是持久的
* `/root` - 容器重启时可能会被重置
* `/tmp` - 临时存储，非持久

### 最佳实践

* 将重要数据存储在 `/workspace`
* 使用外部存储进行备份（S3、GCS 等）
* 将模型下载到持久目录
* 对大型数据集使用卷挂载

## 最佳实践

### 镜像选择

1. **使用近期的标签** - 避免 `latest` 在生产环境中，优先使用有版本的标签
2. **选择合适的基础镜像** - 将 CUDA 版本与您的框架匹配
3. **考虑镜像大小** - 较小的镜像下载更快
4. **检查维护情况** - 优先选择积极维护的镜像

### 安全

1. **暴露最少的端口** - 仅暴露您需要的端口
2. **使用身份验证** - 为 Jupyter/网页界面设置令牌
3. **定期更新** - 使用近期的镜像版本
4. **监控访问** - 检查谁连接到您的服务

### 性能

1. **GPU 兼容性** - 验证 CUDA 版本是否满足您的需求
2. **预先下载模型** - 在自定义镜像中包含模型以加快启动
3. **优化容器** - 使用多阶段构建，最小化图层
4. **缓存管理** - 利用 Docker 图层缓存

## 故障排除

### 镜像无法启动

```bash
# 检查镜像是否存在且为公共镜像
docker pull your-image:tag

# 验证 CUDA 兼容性
nvidia-smi
nvcc --version
```

**常见问题：**

* 镜像不存在或为私有镜像
* CUDA 版本不兼容
* 磁盘空间不足
* 架构错误（arm64 与 x86\_64）

### GPU 无法访问

```bash
# 检查 GPU 可用性
nvidia-smi

# 在容器中测试 CUDA
python -c "import torch; print(torch.cuda.is_available())"
```

**解决方案：**

* 使用支持 GPU 的基础镜像
* 确保 NVIDIA 容器工具包可用
* 检查 CUDA 驱动兼容性

### 无法访问已暴露的端口

1. 等待容器完全启动（检查日志）
2. 验证服务在容器内部正在运行： `netstat -tlnp`
3. 检查服务是否绑定到 0.0.0.0，而不是 127.0.0.1
4. 确认端口在订单表单中已暴露

### 性能问题

* 对模型权重使用本地 SSD 存储
* 根据可用 GPU 内存优化批量大小
* 监控 GPU 利用率： `nvidia-smi -l 1`
* 检查 CPU/内存 使用情况： `htop`

## 快速入门示例

### 部署带 PyTorch 的 Jupyter

```bash
镜像：pytorch/pytorch:2.10.0-cuda13.0-cudnn9-runtime
端口：8888
命令：jupyter lab --ip=0.0.0.0 --allow-root --no-browser
```

### 部署 vLLM API 服务器

```bash
镜像：vllm/vllm-openai:latest
端口：8000
环境：MODEL_NAME=microsoft/DialoGPT-medium
命令：python -m vllm.entrypoints.openai.api_server --model $MODEL_NAME --host 0.0.0.0
```

### 部署 Stable Diffusion WebUI

```bash
镜像：goolashe/automatic1111-sd-webui:latest
端口：7860
命令：--listen --api --xformers
```

### 部署 Ollama

```bash
镜像：ollama/ollama:latest
端口：11434
命令：ollama serve
# 然后：ollama run llama2（在容器内执行）
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.clore.ai/clore.ai/clore.ai-eng-zh/zhen-dui-zu-yong-zhe/docker-images.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
