> 技术文档 > 通过docker安装open-webui_docker 安装 openwebui

通过docker安装open-webui_docker 安装 openwebui

可以直接执行命令(国外镜像):

docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v C:\\dev\\open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main

-v C:\\dev\\open-webui:/app/backend/data :指将宿主机的C盘目录挂载到容器内部的/app/backend/data目录,共享文件

ghcr.io/open-webui/open-webui:main :国外镜像仓库,镜像名和镜像版本

下载巨慢!!!

修改使用国内镜像源:

docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v C:\\dev\\open-webui:/app/backend/data --name open-webui --restart always swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/open-webui/open-webui:main

下载完成后,使用日志报错:

2025-03-28 11:25:22 File \"/usr/local/lib/python3.11/site-packages/transformers/utils/hub.py\", line 441, in cached_file 2025-03-28 11:25:22 raise EnvironmentError( 2025-03-28 11:25:22 OSError: We couldn\'t connect to \'https://huggingface.co\' to load this file, couldn\'t find it in the cached files and it looks like sentence-transformers/all-MiniLM-L6-v2 is not the path to a directory containing a file named config.json. 2025-03-28 11:25:22 Checkout your internet connection or see how to run the library in offline mode at \'https://huggingface.co/docs/transformers/installation#offline-mode\'. 2025-03-28 11:25:31 Cannot determine model snapshot path: Cannot find an appropriate cached snapshot folder for the specified revision on the local disk and outgoing traffic has been disabled. To enable repo look-ups and downloads online, pass \'local_files_only=False\' as input. 2025-03-28 11:25:31 Traceback (most recent call last): 2025-03-28 11:25:31 File \"/app/backend/apps/rag/utils.py\", line 396, in get_model_path 2025-03-28 11:25:31 

open-webui启动时期需要首先在线安装transformers库,但是huggingface.co对于国内来说是经常不可访问

配置上HF_ENDPOINT地址为国内镜像

docker run -d -e HF_ENDPOINT=https://hf-mirror.com -p 3000:8080 --add-host=host.docker.internal:host-gateway -v C:\\\\dev\\\\open-webui:/app/backend/data --name open-webui --restart always open-webui:main

解决!