Files
docker-apps/open-webui-pro/docker-compose.yml
2026-03-20 10:48:59 +08:00

79 lines
2.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
services:
# --- 数据库服务 (PostgreSQL) ---
db:
image: postgres:15-alpine
container_name: open-webui-db
restart: unless-stopped
environment:
- POSTGRES_USER=webui_admin
- POSTGRES_PASSWORD=VURKxKYDmKw8u1CdS6RUf5LC
- POSTGRES_DB=openwebui
volumes:
- ./pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U webui_admin -d openwebui"]
interval: 5s
timeout: 5s
retries: 5
networks:
- webui-network
# --- 缓存服务 (Redis) ---
redis:
image: redis:7-alpine
container_name: open-webui-redis
restart: unless-stopped
volumes:
- ./redisdata:/data
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 5s
timeout: 5s
retries: 5
networks:
- webui-network
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
restart: unless-stopped
ports:
- "3000:8080"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
environment:
# --- 代理设置 (核心修改) ---
- HTTP_PROXY=http://host.docker.internal:7890
- HTTPS_PROXY=http://host.docker.internal:7890
# 极其重要NO_PROXY 必须包含 db 和 redis否则 WebUI 会尝试通过代理连接数据库,导致连接失败
- NO_PROXY=localhost,127.0.0.1,db,redis,host.docker.internal
# 数据库连接配置 (保持不变)
- DATABASE_URL=postgresql://webui_admin:VURKxKYDmKw8u1CdS6RUf5LC@db:5432/openwebui
# Redis 连接配置 (保持不变)
- REDIS_URL=redis://redis:6379/0
# Ollama 接口地址 (指向宿主机)
- OLLAMA_BASE_URL=http://host.docker.internal:11434
# 安全密钥
- WEBUI_SECRET_KEY=HU13YdOhfTaINvCe1PvjlhW0yHVaiaBBqsCtXCWFDAKD44zp
volumes:
- ./data:/app/backend/data
extra_hosts:
- "host.docker.internal:host-gateway" # 允许容器访问宿主机 IP
networks:
- webui-network
volumes:
# 也可以使用上述 ./data 这种本地路径形式,更加直观
pgdata:
redisdata:
data:
networks:
webui-network:
external: true