{"id":242,"date":"2025-02-03T03:57:13","date_gmt":"2025-02-02T19:57:13","guid":{"rendered":"https:\/\/nds.cool\/?p=242"},"modified":"2025-02-03T03:57:13","modified_gmt":"2025-02-02T19:57:13","slug":"3%e3%80%81%e4%bd%bf%e7%94%a8-docker-compose-%e5%bf%ab%e9%80%9f%e9%83%a8%e7%bd%b2-open-webui-%e5%8f%af%e8%a7%86%e5%8c%96%e5%b9%b3%e5%8f%b0","status":"publish","type":"post","link":"https:\/\/blog.wcld.top\/?p=242","title":{"rendered":"3\u3001\u4f7f\u7528 Docker Compose \u5feb\u901f\u90e8\u7f72 Open WebUI \u53ef\u89c6\u5316\u5e73\u53f0"},"content":{"rendered":"<!-- \u6807\u9898 -->\n<div class=\"tech-intro\">\n\n\u901a\u8fc7\u672c\u6559\u7a0b\uff0c\u60a8\u5c06\u638c\u63e1\u57fa\u4e8e Docker Compose \u7684\u4e00\u952e\u5f0f Open WebUI \u90e8\u7f72\u65b9\u6848\uff0c\u5b9e\u73b0\u4e0e Ollama \u7b49\u5927\u6a21\u578b\u670d\u52a1\u7684\u65e0\u7f1d\u5bf9\u63a5\u3002\u672c\u914d\u7f6e\u5df2\u9002\u914d\u5f00\u53d1\u6d4b\u8bd5\u73af\u5883\uff0c\u5305\u542b\u6570\u636e\u6301\u4e45\u5316\u3001\u81ea\u52a8\u91cd\u542f\u7b49\u5173\u952e\u529f\u80fd\u3002\n\n<\/div>\n<!-- \u524d\u7f6e\u6761\u4ef6 -->\n<div class=\"prerequisites\">\n<h2>? \u524d\u7f6e\u8981\u6c42<\/h2>\n<div class=\"wp-block-list\">\n<ul>\n\n<li>Docker Engine \u226520.10.14<\/li>\n\n<li>Docker Compose \u22652.5.1<\/li>\n\n<li>\u5f00\u653e\u7aef\u53e3\uff1a3000\/TCP<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<!-- \u914d\u7f6e\u5c55\u793a -->\n<h2>? docker-compose.yml \u5b8c\u6574\u914d\u7f6e<\/h2>\n<pre class=\"wp-block-code\"><code>version: &#039;3.8&#039;\n\nservices:\n  webui:\n    image: ghcr.io\/open-webui\/open-webui:main\n    container_name: open-webui\n    ports:\n      - &quot;3000:8080&quot;\n    volumes:\n      - .\/data:\/app\/backend\/data  # \u6301\u4e45\u5316\u6570\u636e\u5b58\u50a8\n    environment:\n      - OLLAMA_API_BASE_URL=http:\/\/your-ollama-host:11434\n      - AUTH_DISABLED=true  # \u7981\u7528\u767b\u5f55\u9a8c\u8bc1\uff08\u5f00\u53d1\u73af\u5883\u4f7f\u7528\uff09\n    restart: unless-stopped<\/code><\/pre>\n<!-- \u914d\u7f6e\u89e3\u6790 -->\n<div class=\"config-analysis\">\n<h2>\u2699\ufe0f \u914d\u7f6e\u53c2\u6570\u89e3\u6790<\/h2>\n<div class=\"wp-block-table\">\n<table>\n<thead>\n<tr>\n<th style=\"width: 25%\">\u53c2\u6570<\/th>\n<th>\u8bf4\u660e<\/th>\n<th>\u63a8\u8350\u503c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>ports<\/td>\n<td>\u7aef\u53e3\u6620\u5c04\u89c4\u5219<\/td>\n<td>\u4e3b\u673a\u7aef\u53e3:\u5bb9\u5668\u7aef\u53e3<\/td>\n<\/tr>\n<tr>\n<td>volumes<\/td>\n<td>\u6570\u636e\u6301\u4e45\u5316\u8def\u5f84<\/td>\n<td>\u5efa\u8bae\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\u5982 \/opt\/webui\/data<\/td>\n<\/tr>\n<tr>\n<td>OLLAMA_API_BASE_URL<\/td>\n<td>\u6a21\u578b\u670d\u52a1\u5730\u5740<\/td>\n<td>\u672c\u5730\uff1ahttp:\/\/localhost:11434\n\u8fdc\u7a0b\uff1ahttp:\/\/x.x.x.x:11434<\/td>\n<\/tr>\n<tr>\n<td>AUTH_DISABLED<\/td>\n<td>\u8eab\u4efd\u9a8c\u8bc1\u5f00\u5173<\/td>\n<td>\u751f\u4ea7\u73af\u5883\u5fc5\u987b\u8bbe\u4e3a false<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<!-- \u64cd\u4f5c\u6307\u5357 -->\n<h2>? \u4e94\u6b65\u90e8\u7f72\u6d41\u7a0b<\/h2>\n<div class=\"wp-block-steps\">\n<div class=\"step\">\n<h3>\u6b65\u9aa4 1\uff1a\u521b\u5efa\u90e8\u7f72\u76ee\u5f55<\/h3>\n<pre class=\"wp-block-code\"><code>mkdir openwebui-deploy &amp;&amp; cd openwebui-deploy<\/code><\/pre>\n<\/div>\n<div class=\"step\">\n<h3>\u6b65\u9aa4 2\uff1a\u7f16\u5199\u914d\u7f6e\u6587\u4ef6<\/h3>\n<pre class=\"wp-block-code\"><code>nano docker-compose.yml  # \u7c98\u8d34\u4e0a\u8ff0\u914d\u7f6e\u5185\u5bb9<\/code><\/pre>\n<\/div>\n<div class=\"step\">\n<h3>\u6b65\u9aa4 3\uff1a\u542f\u52a8\u670d\u52a1<\/h3>\n<pre class=\"wp-block-code\"><code>docker compose up -d<\/code><\/pre>\n<\/div>\n<div class=\"step\">\n<h3>\u6b65\u9aa4 4\uff1a\u9a8c\u8bc1\u670d\u52a1\u72b6\u6001<\/h3>\n<pre class=\"wp-block-code\"><code>docker compose ps  # \u5e94\u663e\u793a webui \u670d\u52a1\u72b6\u6001\u4e3a running<\/code><\/pre>\n<\/div>\n<div class=\"step\">\n<h3>\u6b65\u9aa4 5\uff1a\u8bbf\u95ee Web \u754c\u9762<\/h3>\n\u6d4f\u89c8\u5668\u6253\u5f00\uff1a<a href=\"http:\/\/your-server-ip:3000\" target=\"_blank\" rel=\"noopener\">http:\/\/your-server-ip:3000<\/a>\n\n<\/div>\n<\/div>\n<!-- \u5b89\u5168\u8b66\u544a -->\n<div class=\"alert-box warning\">\n<h4>\u26a0\ufe0f \u5b89\u5168\u6ce8\u610f\u4e8b\u9879<\/h4>\n<div class=\"wp-block-list\">\n<ul>\n\n<li>\u751f\u4ea7\u73af\u5883\u5fc5\u987b\u914d\u7f6e HTTPS<\/li>\n\n<li>\u5efa\u8bae\u8bbe\u7f6e <code>WEBUI_SECRET_KEY<\/code> \u73af\u5883\u53d8\u91cf<\/li>\n\n<li>\u7981\u7528\u9ed8\u8ba4\u7ba1\u7406\u5458\u8d26\u53f7\u5bc6\u7801<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<!-- \u9ad8\u7ea7\u914d\u7f6e -->\n<h2>? \u751f\u4ea7\u73af\u5883\u589e\u5f3a\u65b9\u6848<\/h2>\n<div class=\"wp-block-columns\"><!-- &#21015;1&#65306;HTTPS&#37197;&#32622; -->\n<div class=\"wp-block-column\">\n<h3>\u65b9\u6848\u4e00\uff1a\u542f\u7528 HTTPS<\/h3>\n<pre class=\"wp-block-code\"><code>environment:\n  - HTTPS_ENABLED=true\n  - SSL_CERT_PATH=\/path\/to\/cert.pem\n  - SSL_KEY_PATH=\/path\/to\/key.pem<\/code><\/pre>\n<\/div>\n<!-- &#21015;2&#65306;&#36164;&#28304;&#38480;&#21046; -->\n<div class=\"wp-block-column\">\n<h3>\u65b9\u6848\u4e8c\uff1a\u8d44\u6e90\u914d\u989d<\/h3>\n<pre class=\"wp-block-code\"><code>deploy:\n  resources:\n    limits:\n      cpus: &#039;2&#039;\n      memory: 4G<\/code><\/pre>\n<\/div>\n<\/div>\n<!-- \u6545\u969c\u6392\u67e5 -->\n<h2>?\ufe0f \u5e38\u89c1\u95ee\u9898\u6392\u67e5\u8868<\/h2>\n<div class=\"wp-block-table\">\n<table>\n<thead>\n<tr>\n<th>\u73b0\u8c61<\/th>\n<th>\u89e3\u51b3\u65b9\u6848<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u7aef\u53e3 3000 \u88ab\u5360\u7528<\/td>\n<td>\u4fee\u6539 ports \u4e3a &#8220;\u65b0\u7aef\u53e3:8080&#8221;<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u636e\u5377\u6743\u9650\u9519\u8bef<\/td>\n<td>\u6267\u884c <code>chmod 755 .\/data<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u65e0\u6cd5\u8fde\u63a5 Ollama<\/td>\n<td>\u68c0\u67e5\u9632\u706b\u5899\u8bbe\u7f6e\u548c\u7f51\u7edc\u8fde\u901a\u6027<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>\u901a\u8fc7\u672c\u6559\u7a0b\uff0c\u60a8\u5c06\u638c\u63e1\u57fa\u4e8e Docker Compose \u7684\u4e00\u952e\u5f0f Open WebUI \u90e8\u7f72\u65b9\u6848\uff0c\u5b9e\u73b0\u4e0e Ollama \u2026<\/p>","protected":false},"author":1,"featured_media":243,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-242","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai"],"_links":{"self":[{"href":"https:\/\/blog.wcld.top\/index.php?rest_route=\/wp\/v2\/posts\/242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.wcld.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.wcld.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.wcld.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.wcld.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=242"}],"version-history":[{"count":0,"href":"https:\/\/blog.wcld.top\/index.php?rest_route=\/wp\/v2\/posts\/242\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.wcld.top\/index.php?rest_route=\/wp\/v2\/media\/243"}],"wp:attachment":[{"href":"https:\/\/blog.wcld.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.wcld.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.wcld.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}