运行 ollama/webui
使用 docker run 运行
shell
docker network create llm-net
docker run -d --rm --name ollama-cpu --network llm-net -p 11434:11434 -v ollama-data:/root/.ollama --cpus=8 -e OLLAMA_GPU=off -e OLLAMA_NUM_PARALLEL=1 ollama/ollama
docker run -d --rm --name ollama-webui --network llm-net -p 8000:8080 -v open-webui:/app/backend/data -e OLLAMA_API_BASE_URL=http://ollama-cpu:11434 -e WEBUI_SECRET_KEY=ollama-webui -e ENABLE_GPU=false ghcr.io/open-webui/open-webui:main或者使用 docker compose 运行
bash
cat cat docker-compose.ymlyml
version: "3.3"
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
ports:
- "11434:11434"
volumes:
- ollama:/root/.ollama
networks:
- ollama-net
restart: unless-stopped
open-webui:
image: ghcr.io/open-webui/open-webui:latest # 更新到最新版
container_name: open-webui
depends_on:
- ollama
ports:
- "8000:8080"
environment:
- OLLAMA_BASE_URL=http://ollama:11434
- ENABLE_MODEL_FILTER=false # 禁用模型过滤
volumes:
- open-webui:/app/backend/data
networks:
- ollama-net
restart: unless-stopped
volumes:
ollama:
open-webui:
networks:
ollama-net:
driver: bridgebash
docker-compose up -d- 浏览器打开 http://localhost:8080 → 首次要求注册管理员账号,随意填写即可。
安装 qwen2.5:7b
- 两种方式可以安装:
- 或者,登陆 http://localhost:8080, 进入后左上角,选择模型,搜索框中输入 qwen3:4b-q4_K_M, 按照提示进行安装。
- 或者,进入 ollama-cpu 安装运行
bash
docker exec -it ollama-cpu bash
ollama run ollama-cpu qwen3:4b-q4_K_M- 登陆,http://localhost:8080,左上角模型选择 qwen3:4b-q4_K_M 即可
设置当前对话为翻译模式
- 进入会话后,输入
txt
/system You are a professional Chinese to English translator.
Rules:
1. Auto-detect the source language.
2. translate input Chinese → output English
3. Keep the original tone and style.
4. After translating, scan the English text once more:
- Replace any occurrence of “Parameter Name”, “Param Name”, “参数名称” with “Name”.
- Do the same for their lowercase/plural forms.
5. Do not add any explanations or notes outside the translation.- 输入中文或者中英文文本,只会给出翻译后的英文文本