> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-zh/ru-men-zhi-nan/docker-images.md).

# Docker 镜像

适用于 Clore.ai 上 AI 工作负载的即用型 Docker 镜像

可直接部署的 CLORE.AI 上 AI 工作负载 Docker 镜像。

{% hint style="success" %}
可直接在以下位置部署这些镜像 [CLORE.AI 市场](https://clore.ai/marketplace).
{% endhint %}

## 快速部署参考

### 最受欢迎

| 任务             | 镜像                                   | 端口        |
| -------------- | ------------------------------------ | --------- |
| 与 AI 聊天        | `ollama/ollama`                      | 22, 11434 |
| 类似 ChatGPT 的界面 | `ghcr.io/open-webui/open-webui`      | 22, 8080  |
| 图像生成           | `universonic/stable-diffusion-webui` | 22, 7860  |
| 基于节点的图像生成      | `yanwk/comfyui-boot`                 | 22, 8188  |
| LLM API 服务器    | `vllm/vllm-openai`                   | 22, 8000  |

***

## 语言模型

### Ollama

**通用 LLM 运行器——运行任何模型的最简单方式。**

```
镜像：ollama/ollama
端口：22/tcp，11434/http
命令：ollama serve
```

**部署后：**

```bash
# SSH 登录服务器
ssh -p <port> root@<proxy>

# 拉取并运行模型
ollama pull llama3.2
ollama run llama3.2
```

**环境变量：**

```
OLLAMA_HOST=0.0.0.0
OLLAMA_MODELS=/root/.ollama/models
```

***

### Open WebUI

**面向 Ollama 的类 ChatGPT 界面。**

```
镜像：ghcr.io/open-webui/open-webui:ollama
端口：22/tcp, 8080/http
```

内置 Ollama。通过 HTTP 端口访问。

**独立模式（连接到现有的 Ollama）：**

```
镜像：ghcr.io/open-webui/open-webui:main
端口：22/tcp, 8080/http
环境变量：OLLAMA_BASE_URL=http://localhost:11434
```

***

### vLLM

**具有 OpenAI 兼容 API 的高性能 LLM 推理服务。**

```
镜像：vllm/vllm-openai:latest
端口：22/tcp，8000/http
命令：python -m vllm.entrypoints.openai.api_server --model meta-llama/Meta-Llama-3.1-8B-Instruct --host 0.0.0.0
```

**对于更大的模型（多 GPU）：**

```bash
python -m vllm.entrypoints.openai.api_server \
    --model meta-llama/Meta-Llama-3.1-70B-Instruct \
    --tensor-parallel-size 2 \\
    --host 0.0.0.0
```

**环境变量：**

```
HUGGING_FACE_HUB_TOKEN=<your-token>  # 用于受限模型
```

***

### Text Generation Inference（TGI）

**HuggingFace 的生产级 LLM 服务器。**

```
镜像：ghcr.io/huggingface/text-generation-inference:latest
端口：22/tcp, 8080/http
命令：--model-id meta-llama/Meta-Llama-3.1-8B-Instruct
```

**环境变量：**

```
HUGGING_FACE_HUB_TOKEN=<your-token>
MAX_INPUT_LENGTH=4096
MAX_TOTAL_TOKENS=8192
```

***

## 图像生成

### Stable Diffusion WebUI（AUTOMATIC1111）

**最受欢迎的带扩展的 SD 界面。**

```
镜像：universonic/stable-diffusion-webui:latest
端口：22/tcp，7860/http
```

**对于低显存（8GB 或更少）：**

```bash
./webui.sh --listen --medvram --xformers
```

**对于 API 访问：**

```bash
./webui.sh --listen --xformers --api
```

***

### ComfyUI

**面向高级用户的基于节点工作流。**

```
镜像：yanwk/comfyui-boot:cu130-slim
端口：22/tcp、8188/http
环境：CLI_ARGS=--listen 0.0.0.0
```

**备用镜像：**

```
# 含常用扩展
镜像：yanwk/comfyui-boot:cu130-megapak-pt211

# 极简
镜像：pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel
```

**手动设置命令：**

```bash
git clone https://github.com/comfyanonymous/ComfyUI && cd ComfyUI && pip install -r requirements.txt && python main.py --listen 0.0.0.0
```

***

### Fooocus

**简化的 SD 界面，类似 Midjourney。**

```
镜像：pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel
端口：22/tcp, 7865/http
命令：git clone https://github.com/lllyasviel/Fooocus && cd Fooocus && pip install -r requirements.txt && python launch.py --listen
```

***

### FLUX

**最新的高质量图像生成。**

使用带 FLUX 节点的 ComfyUI：

```
镜像：yanwk/comfyui-boot:cu130-slim
端口：22/tcp、8188/http
```

或通过 Diffusers：

```
镜像：pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel
端口：22/tcp
```

```python
# SSH 后
pip install diffusers transformers accelerate
python << 'EOF'
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell")
pipe.enable_model_cpu_offload()
image = pipe("A cat", num_inference_steps=4).images[0]
image.save("output.png")
EOF
```

***

## 视频生成

### Stable Video Diffusion

```
镜像：pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel
端口：22/tcp
```

```bash
pip install diffusers transformers accelerate
python << 'EOF'
from diffusers import StableVideoDiffusionPipeline
from diffusers.utils import load_image, export_to_video
pipe = StableVideoDiffusionPipeline.from_pretrained(
    "stabilityai/stable-video-diffusion-img2vid-xt",
    variant="fp16"
)
pipe.to("cuda")
image = load_image("input.png")
frames = pipe(image, num_frames=25).frames[0]
export_to_video(frames, "output.mp4", fps=7)
EOF
```

***

### AnimateDiff

与 ComfyUI 配合使用：

```
镜像：yanwk/comfyui-boot:cu130-slim
端口：22/tcp、8188/http
```

通过 ComfyUI Manager 安装 AnimateDiff 节点。

***

## 音频与语音

### Whisper（转录）

```
镜像：onerahmet/openai-whisper-asr-webservice:latest
端口：22/tcp，9000/http
环境变量：ASR_MODEL=large-v3
```

**API 用法：**

```bash
curl -X POST "http://localhost:9000/asr" \
    -F "audio_file=@audio.mp3" \
    -F "task=transcribe"
```

***

### Bark（文本转语音）

```
镜像：pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel
端口：22/tcp
```

```bash
pip install bark
python << 'EOF'
from bark import SAMPLE_RATE, generate_audio, preload_models
from scipy.io.wavfile import write as write_wav
preload_models()
audio = generate_audio("Hello, this is a test.")
write_wav("output.wav", SAMPLE_RATE, audio)
EOF
```

***

### Stable Audio

```
镜像：pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel
端口：22/tcp
```

```bash
pip install stable-audio-tools
# 访问模型需要 HF 令牌
```

***

## 视觉模型

### LLaVA

```
镜像：pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel
端口：22/tcp
```

```bash
pip install llava
python -m llava.serve.cli --model-path liuhaotian/llava-v1.6-34b
```

***

### Llama 3.2 Vision

使用 Ollama：

```
镜像：ollama/ollama
端口：22/tcp，11434/http
```

```bash
ollama pull llama3.2-vision
ollama run llama3.2-vision "describe this image" --images photo.jpg
```

***

## 开发与训练

### PyTorch 基础镜像

**用于自定义设置和训练。**

```
镜像：pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel
端口：22/tcp
```

包含：CUDA 12.8、cuDNN 9、PyTorch 2.11

***

### Jupyter Lab

**面向 ML 的交互式笔记本。**

```
镜像：quay.io/jupyter/pytorch-notebook:cuda12-pytorch-2.11.0
端口：22/tcp，8888/http
```

或使用带 Jupyter 的 PyTorch 基础镜像：

```bash
pip install jupyterlab
jupyter lab --ip=0.0.0.0 --allow-root --no-browser
```

***

### Kohya 训练

**用于 LoRA 和模型微调。**

```
镜像：pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel
端口：22/tcp
```

```bash
git clone https://github.com/kohya-ss/sd-scripts
cd sd-scripts
pip install -r requirements.txt
# 使用训练脚本
```

***

## 基础镜像参考

{% hint style="danger" %}
**将 CUDA 构建版本与显卡匹配。** RTX 50 系列（Blackwell）需要 CUDA 12.8+ 和 PyTorch 2.7+；CUDA 12.4 镜像在其上会失败，报错 `该设备上没有可用于执行的内核镜像`。完整矩阵： [CUDA 与 PyTorch 兼容性](/guides/guides_v2-zh/ru-men-zhi-nan/cuda-pytorch-compatibility.md).
{% endhint %}

### NVIDIA 官方

| 镜像                                       | CUDA | 使用场景                            |
| ---------------------------------------- | ---- | ------------------------------- |
| `nvidia/cuda:12.8.1-devel-ubuntu22.04`   | 12.8 | CUDA 开发版，适用于 Turing → Blackwell |
| `nvidia/cuda:12.8.1-runtime-ubuntu22.04` | 12.8 | 仅 CUDA 运行时                      |
| `nvidia/cuda:13.0.3-devel-ubuntu24.04`   | 13.0 | 最新；仅适用于 Turing 及以上              |
| `nvidia/cuda:11.8.0-devel-ubuntu22.04`   | 11.8 | 旧款显卡（Pascal、旧 Volta 架构）         |

### PyTorch 官方

| 镜像                                             | PyTorch | CUDA | 显卡                           |
| ---------------------------------------------- | ------- | ---- | ---------------------------- |
| `pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel` | 2.11    | 12.8 | **默认。** Ampere、Ada、Blackwell |
| `pytorch/pytorch:2.13.0-cuda13.2-cudnn9-devel` | 2.13    | 13.2 | Turing 及更新                   |
| `pytorch/pytorch:2.10.0-cuda12.8-cudnn9-devel` | 2.10    | 12.8 | 支持 Tesla V100 的最后一个版本        |
| `pytorch/pytorch:2.5.1-cuda12.4-cudnn9-devel`  | 2.5     | 12.4 | Pascal 挖矿卡                   |

### HuggingFace

| 镜像                                              | 用途                     |
| ----------------------------------------------- | ---------------------- |
| `huggingface/transformers-pytorch-gpu`          | Transformers + PyTorch |
| `ghcr.io/huggingface/text-generation-inference` | TGI 服务器                |

***

## 环境变量

### 常用变量

| 变量                       | 描述                | 示例             |
| ------------------------ | ----------------- | -------------- |
| `HUGGING_FACE_HUB_TOKEN` | 用于受限模型的 HF API 令牌 | `hf_xxx`       |
| `CUDA_VISIBLE_DEVICES`   | GPU 选择            | `0,1`          |
| `TRANSFORMERS_CACHE`     | 模型缓存目录            | `/root/.cache` |

### Ollama 变量

| 变量                    | 描述   | 默认值                |
| --------------------- | ---- | ------------------ |
| `OLLAMA_HOST`         | 绑定地址 | `127.0.0.1`        |
| `OLLAMA_MODELS`       | 模型目录 | `~/.ollama/models` |
| `OLLAMA_NUM_PARALLEL` | 并行请求 | `1`                |

### vLLM 变量

| 变量                       | 描述                  |
| ------------------------ | ------------------- |
| `VLLM_ATTENTION_BACKEND` | 注意力实现               |
| `VLLM_USE_MODELSCOPE`    | 使用 ModelScope 替代 HF |

***

## 端口参考

| 端口    | 协议   | 服务                       |
| ----- | ---- | ------------------------ |
| 22    | TCP  | SSH                      |
| 7860  | HTTP | Gradio（SD WebUI、Fooocus） |
| 7865  | HTTP | Fooocus 替代方案             |
| 8000  | HTTP | vLLM API                 |
| 8080  | HTTP | Open WebUI、TGI           |
| 8188  | HTTP | ComfyUI                  |
| 8888  | HTTP | Jupyter                  |
| 9000  | HTTP | Whisper API              |
| 11434 | TCP  | Ollama API               |

***

## 提示

### 持久化存储

挂载卷以在重启间保留数据：

```bash
docker run -v /data/models:/root/.cache/huggingface ...
```

### GPU 选择

对于多 GPU 系统：

```bash
docker run --gpus '"device=0,1"' ...
# 或
CUDA_VISIBLE_DEVICES=0,1
```

### 内存管理

如果显存不足：

1. 使用更小的模型
2. 启用 CPU 卸载
3. 减小批量大小
4. 使用量化模型（GGUF Q4）

## 下一步

* [GPU 对比](/guides/guides_v2-zh/ru-men-zhi-nan/gpu-comparison.md) - 选择合适的 GPU
* [模型兼容性](/guides/guides_v2-zh/ru-men-zhi-nan/model-compatibility.md) - 哪些模型能在哪运行
* [快速入门指南](/guides/guides_v2-zh/quickstart.md) - 5 分钟上手


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-zh/ru-men-zhi-nan/docker-images.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
