PageSourceSearch

https://mblog.club/docker_install.html

html mblog.club collected 2026-09-25 21:06:12 UTC 9,539 bytes, 212 lines download raw bytes

1<!DOCTYPE html>
2
3<html lang="en">
4  <head>
5    <meta charset="utf-8" />
6    <meta name="viewport" content="width=device-width, initial-scale=1" />
7
8    <title>Docker安装MBlog</title></title>
9    <meta
10      name="description"
11      content="MBlog-开源自建个人微博,支持单/多用户,支持云存储,支持匿名/评论/点赞,支持响应式设计,支持评论审核等."
12    />
13    <meta name="author" content="SitePoint" />
14    <meta name="keywords" content="开源,微博,自建">
15    <meta property="og:title" content="开源自建个人微博" />
16    <meta property="og:type" content="website" />
17    <meta
18      property="og:url"
19      content="https://mblog.club"
20    />
21    <meta
22      property="og:description"
23      content="开源自建个人微博"
24    />
25    <meta property="og:image" content="image.png" />
26    <meta name="description" content="首先在任意目录下创建 mblog 文件夹,后续的图片,数据库等文件会在这里放. SQLite 版本或者图片存储是本地存储的,这个目录一定要映射出来,不然 Docker 容器删除了之后,数据就丢了. mkdir mblog &amp;&amp; cd mblog  然后执行 Docker 命令启动容器 前后分离 + MYSQL 版本服务端: docker run --volume&#x3D;$&amp;#123;PW">
27<meta property="og:type" content="article">
28<meta property="og:title" content="Docker安装MBlog">
29<meta property="og:url" content="https://mblog.club/docker_install.html">
30<meta property="og:site_name" content="MBlog-开源自建个人微博">
31<meta property="og:description" content="首先在任意目录下创建 mblog 文件夹,后续的图片,数据库等文件会在这里放. SQLite 版本或者图片存储是本地存储的,这个目录一定要映射出来,不然 Docker 容器删除了之后,数据就丢了. mkdir mblog &amp;&amp; cd mblog  然后执行 Docker 命令启动容器 前后分离 + MYSQL 版本服务端: docker run --volume&#x3D;$&amp;#123;PW">
32<meta property="og:locale" content="en_US">
33<meta property="article:published_time" content="2023-06-16T07:47:08.000Z">
34<meta property="article:modified_time" content="2023-06-20T06:27:39.053Z">
35<meta property="article:author" content="JerryWang">
36<meta property="article:tag" content="开源,微博,自建">
37<meta name="twitter:card" content="summary">
38
39    <link rel="icon" href="/img/logo.webp">     
40    
40<script src="https://cdn.jsdelivr.net/npm/@unocss/runtime/uno.global.js"></script>
40
41    <link rel="stylesheet" href="https://cdn.staticfile.org/lxgw-wenkai-screen-webfont/1.7.0/lxgwwenkaiscreen.min.css">
42    
42<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
42
43    <link rel="stylesheet" href="/css/main.css">
44    <link rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/11.8.0/styles/kimbie-dark.min.css">
45    
45<script src="https://cdn.staticfile.org/highlight.js/11.8.0/highlight.min.js"/>
46    
46<script src="/js/main.js"></script>
46
47    
47<script>hljs.highlightAll();</script>
47
48  
49      
50<link rel="stylesheet" href="/css/prism.css">
51
52    
53  <meta name="generator" content="Hexo 6.3.0"></head>
54
55  <body>
56      <div style="display: none;" class="lt-lg:w-full w-1/2 mx-auto"  id="mblog-main">
57        <div class="flex flex-row justify-between mb-2 items-center pb-2" style="border-bottom: 1px solid #ccc">
58  <div class="flex flex-row items-center">
59    <img src="/img/logo.webp" alt="" width="60px" height="60px" />
60
61    <div class="ml-4">
62      <a href="/" class="decoration-none text-6 text-gray-500 lt-lg:hidden">
63        MBlog-开源自建个人微博
64      </a>
65    </div>
66  </div>
67
68  <div class="flex flex-row gap-2 ml-2">
69    <a target="_blank" rel="noopener" href="https://jsonconvert.net" class="decoration-none hover:text-gray-7 flex flex-row gap-1 items-center">
70      <img src="/img/json.svg" width="16px" height="16px" />
71      <div class="text-gray-5">JSON Converter</div>
72    </a>
73    <a href="/" class="decoration-none hover:text-gray-7 flex flex-row gap-1 items-center">
74      <img src="/img/home.svg" width="16px" height="16px" />
75      <div class="text-gray-5">首页</div>
76    </a>
77    <a target="_blank" rel="noopener" href="https://dev.mblog.club" class="decoration-none hover:text-gray-7 flex flex-row gap-1 items-center">
78      <img src="/img/square.svg" width="16px" height="16px" />
79      <div class="text-gray-5">极简Markdown博客</div>
80    </a>
81    <a href="/feature" class="decoration-none hover:text-gray-7 flex flex-row gap-1 items-center">
82      <img src="/img/feature.svg" width="16px" height="16px" />
83      <div class="text-gray-5">特性</div>
84    </a>
85    <a href="/release.html" class="decoration-none hover:text-gray-7 flex flex-row gap-1 items-center">
86      <img src="/img/history.svg" width="16px" height="16px" />
87      <div class="text-gray-5">发布历史</div>
88    </a>
89    <a href="https://github.com/mblog-backend/backend" target="_blank"
90      class="decoration-none hover:text-gray-7 flex flex-row gap-1 items-center">
91      <img src="/img/github.svg" width="16px" height="16px" />
92      <div class="text-gray-5">源码</div>
93    </a>
94    <a href="https://hotnews.pw/t/mblog" target="_blank"
95      class="decoration-none hover:text-gray-7 flex flex-row gap-1 items-center">
96      <img src="/img/comment.svg" width="16px" height="16px" />
97      <div class="text-gray-5">意见反馈</div>
98    </a>
99  </div>
100</div> <div class="flex flex-row">
101  
102  <div class="flex flex-col flex-1 ">
103    <div class="font-700 text-2xl text-gray-5">Docker安装MBlog</div>
104    <div class="text-sm mt-2">
105      <span>Published at 2023/06/16 15:47</span>
106      <span style="display: inline-block; margin: 0 5px">|</span>
107      <span id="busuanzi_container_page_pv"
108        ><span id="busuanzi_value_page_pv"></span> Views.</span
109      >
110    </div>
111
112    <div class="my-4 md-content" id="md-content"><p>首先在任意目录下创建 mblog 文件夹,后续的图片,数据库等文件会在这里放.</p>
113<p><strong>SQLite 版本或者图片存储是本地存储的,这个目录一定要映射出来,不然 Docker 容器删除了之后,数据就丢了</strong>.</p>
114<pre><code class="bash">mkdir mblog &amp;&amp; cd mblog
115</code></pre>
116<p>然后执行 Docker 命令启动容器</p>
117<h4 id="前后分离-MYSQL-版本"><a href="#前后分离-MYSQL-版本" class="headerlink" title="前后分离 + MYSQL 版本"></a>前后分离 + MYSQL 版本</h4><p>服务端:</p>
118<pre><code class="bash">docker run --volume=$&#123;PWD&#125;/mblog:/opt/mblog \
119--publish=你要映射的后端端口,必填:38321 \
120--restart=always \
121--name=mblog-backend \
122--detach=true \
123--env MYSQL_USER=数据库用户名,必填 \
124--env MYSQL_PASS=数据库密码,必填 \
125--env MYSQL_URL=数据库地址:端口,必填,前面没有http(s) \
126--env MYSQL_DB=数据库名称,必填) \
127--env MBLOG_FRONT_DOMAIN=mblog前端地址(配置跨域使用的,带http(s),有端口带端口,docker启动的这里是宿主机的IP,必填) \
128kingwrcy/mblog-backend:latest
129</code></pre>
130<p>前端:</p>
131<pre><code class="bash">docker run \
132--publish=你要映射的前端端口,必填:80 \
133--restart=always \
134--name=mblog-front \
135--detach=true \
136--env MBLOG_SERVER_URL=mblog服务端地址,带http(s),有端口带端口,docker启动的这里是宿主机的IP,必填 \
137kingwrcy/mblog-front:latest
138</code></pre>
139<h5 id="说明"><a href="#说明" class="headerlink" title="说明"></a>说明</h5><ol>
140<li>上面的每一项都是必填项.</li>
141<li>关于环境变量的说明看<a href="/environment.html">这里</a>,还支持其他的环境变量,比如限制服务端内存大小,开启 API 文档等等.</li>
142<li>需要 SQLite 的版本的,往下看.</li>
143</ol>
144<hr>
145<h4 id="前后不分离-SQLite-版本"><a href="#前后不分离-SQLite-版本" class="headerlink" title="前后不分离 + SQLite 版本"></a>前后不分离 + SQLite 版本</h4><pre><code class="bash">docker run --volume=$&#123;PWD&#125;/mblog:/opt/mblog \
146--publish=你要映射的后端端口,必填:38321 \
147--restart=always \
148--name=mblog-backend \
149--detach=true \
150--env DB_TYPE=-sqlite \
151kingwrcy/mblog:latest
152</code></pre>
153<h5 id="说明-1"><a href="#说明-1" class="headerlink" title="说明"></a>说明</h5><ol>
154<li>前后不分离的版本只有一个容器,前端和后端都在这个容器里面.</li>
155<li>使用 SQLite 版本时<strong>注意环境变量</strong>的<code>DB_TYPE</code>的值前面有个<code>-</code>.</li>
156</ol>
157</div>
158
159    <div id="Comments"></div>
160  </div>
161   
162</div>
163
164
165
166
167
168 <div
169  class="flex flex-row mt-4 py-2 my-footer gap-4 lt-lg:text-xs"
170  style="border-top: 1px solid #ccc"
171>
172  <div>
173    <span>© 2023 </span>
174    <a href="/">MBlog</a>
175  </div>
176
177  <div>
178    <a href="https://github.com/mblog-backend/backend" target="_blank"
179      ><img
180        alt="GitHub Repo stars"
181        src="https://img.shields.io/github/stars/mblog-backend/backend?style=social"
182    /></a>
183  </div>
184
185  <div class="lt-lg:hidden">
186    <span>Email</span>
187    <a href="mailto:[email protected]">[email protected]</a>
188  </div>
189  <div class="lt-lg:hidden">
190    <a href="https://beian.miit.gov.cn" target="_blank"
191      >沪ICP备18013328号-3</a
192    >
193  </div>
194  <div>
195    <span id="busuanzi_container_site_pv" style="display: none"
196      >访问量<span id="busuanzi_value_site_pv"></span>次</span
197    >
198  </div>
199</div>
200<script
201  type="text/javascript"
202  src="https://js.users.51.la/21541709.js"
203></script>
203
204
205      </div>
206  </body>
207  
207<script>
208    document.addEventListener('DOMContentLoaded',()=>{
209      document.getElementById('mblog-main').style.display ='block'
210    })
211    </script>
211
212</html>

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.