{"id":62457,"date":"2026-01-20T00:34:09","date_gmt":"2026-01-19T16:34:09","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/62457.html"},"modified":"2026-01-20T00:34:09","modified_gmt":"2026-01-19T16:34:09","slug":"%e7%ac%ac%e5%9b%9b%e9%98%b6%e6%ae%b5%ef%bc%9a%e6%95%b0%e6%8d%ae%e4%b8%8e%e7%bd%91%e7%bb%9c-%e8%bf%9b%e9%98%b6%e7%af%87","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/62457.html","title":{"rendered":"\u7b2c\u56db\u9636\u6bb5\uff1a\u6570\u636e\u4e0e\u7f51\u7edc (\u8fdb\u9636\u7bc7)"},"content":{"rendered":"<p>\u6b22\u8fce\u6765\u5230\u7b2c\u56db\u9636\u6bb5&#xff1a;\u8fdb\u9636\u7bc7\u3002<\/p>\n<p>\u5982\u679c\u8bf4\u524d\u4e09\u4e2a\u9636\u6bb5\u662f\u8ba9\u4f60\u5b66\u4f1a\u201c\u628a\u7a0b\u5e8f\u8dd1\u8d77\u6765\u201d&#xff0c;\u90a3\u8fd9\u4e2a\u9636\u6bb5\u5c31\u662f\u8981\u89e3\u51b3\u4e24\u4e2a\u6700\u6838\u5fc3\u7684\u751f\u4ea7\u95ee\u9898&#xff1a;\u201c\u6570\u636e\u5b58\u54ea&#xff1f;\u201d \u548c \u201c\u600e\u4e48\u8054\u7f51&#xff1f;\u201d<\/p>\n<p>\u5148\u770b 4.1&#xff0c;\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u75db\u7684\u9886\u609f\u3002<\/p>\n<hr \/>\n<h4>4.1 \u6570\u636e\u6301\u4e45\u5316 (Data Persistence)<\/h4>\n<h5>1. \u4e00\u4e2a\u53ef\u6015\u7684\u4e8b\u5b9e<\/h5>\n<p>\u8fd8\u8bb0\u5f97\u6211\u4eec\u4e4b\u524d\u8bf4\u7684\u5417&#xff1f;\u5bb9\u5668\u662f\u201c\u80f6\u56ca\u516c\u5bd3\u201d\u3002 \u5f53\u4f60\u5220\u9664\u4e00\u4e2a\u5bb9\u5668 (docker rm)&#xff0c;\u4f60\u5728\u5bb9\u5668\u91cc\u4ea7\u751f\u7684\u6240\u6709\u6587\u4ef6\u3001\u4fee\u6539\u7684\u6570\u636e&#xff0c;\u90fd\u4f1a\u77ac\u95f4\u7070\u98de\u70df\u706d&#xff01;<\/p>\n<p>\u573a\u666f\u6a21\u62df&#xff1a;\u4f60\u8fd0\u884c\u4e86\u4e00\u4e2a MySQL \u6570\u636e\u5e93\u5bb9\u5668&#xff0c;\u8f9b\u8f9b\u82e6\u82e6\u5b58\u4e86\u4e00\u4e2a\u6708\u7684\u7528\u6237\u6570\u636e\u3002\u67d0\u5929\u4f60\u8bef\u5220\u4e86\u5bb9\u5668&#xff0c;\u6216\u8005\u5bb9\u5668\u5d29\u4e86\u91cd\u88c5\u2026\u2026\u7830&#xff01;\u6570\u636e\u5168\u6ca1\u4e86\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48&#xff1f; \u56e0\u4e3a\u5bb9\u5668\u7684\u8bbe\u8ba1\u521d\u8877\u5c31\u662f**\u201c\u7528\u5b8c\u5373\u6254\u201d** (Disposable)\u3002\u5bb9\u5668\u91cc\u7684\u5b58\u50a8\u5c42\u662f\u4e34\u65f6\u7684\u3002<\/p>\n<h5>2. \u89e3\u51b3\u65b9\u6848&#xff1a;\u6302\u8f7d (Mount)<\/h5>\n<p>\u4e3a\u4e86\u4fdd\u4f4f\u6570\u636e&#xff0c;Docker \u5141\u8bb8\u6211\u4eec\u628a\u5bbf\u4e3b\u673a&#xff08;\u4f60\u7684\u7535\u8111&#xff09;\u7684\u4e00\u90e8\u5206\u786c\u76d8\u7a7a\u95f4&#xff0c;\u201c\u501f\u201d\u7ed9\u5bb9\u5668\u7528\u3002 \u8fd9\u6837&#xff0c;\u6570\u636e\u5176\u5b9e\u662f\u5b58\u5728\u4f60\u7535\u8111\u786c\u76d8\u4e0a\u7684&#xff0c;\u5bb9\u5668\u53ea\u662f\u901a\u8fc7\u4e00\u4e2a\u201c\u7a97\u53e3\u201d\u53bb\u8bfb\u5199\u5b83\u3002\u5373\u4f7f\u5bb9\u5668\u70b8\u4e86&#xff0c;\u6570\u636e\u8fd8\u5728\u4f60\u7535\u8111\u91cc\u3002<\/p>\n<p>\u4e3b\u8981\u6709\u4e24\u79cd\u65b9\u5f0f&#xff0c;\u5fc5\u987b\u5206\u6e05\u695a&#xff08;\u9762\u8bd5\u5fc5\u8003&#xff0c;\u5de5\u4f5c\u5fc5\u7528&#xff09;&#xff1a;<\/p>\n<hr \/>\n<h5>&#x1f170;\ufe0f \u65b9\u5f0f\u4e00&#xff1a;Bind Mounts (\u6302\u8f7d\u76ee\u5f55)<\/h5>\n<ul>\n<li>\u901a\u4fd7\u89e3\u91ca&#xff1a;\u201c\u5b9e\u65f6\u540c\u6b65\u6587\u4ef6\u5939\u201d\u3002<\/li>\n<li>\u539f\u7406&#xff1a;\u628a\u4f60\u7535\u8111\u684c\u9762\u4e0a\u67d0\u4e2a\u5177\u4f53\u7684\u6587\u4ef6\u5939&#xff0c;\u76f4\u63a5\u6620\u5c04\u5230\u5bb9\u5668\u91cc\u7684\u67d0\u4e2a\u6587\u4ef6\u5939\u3002<\/li>\n<li>\u573a\u666f&#xff1a;\u5f00\u53d1\u4ee3\u7801\u65f6\u6700\u5e38\u7528&#xff01;\n<ul>\n<li>\u4f60\u5728\u7535\u8111\u4e0a\u6539\u4e86\u4ee3\u7801 (app.py)&#xff0c;\u5bb9\u5668\u91cc\u7acb\u523b\u540c\u6b65\u66f4\u65b0&#xff0c;\u4e0d\u9700\u8981\u6bcf\u6b21\u6539\u4ee3\u7801\u90fd\u91cd\u542f\u5bb9\u5668\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>&#x1f171;\ufe0f \u65b9\u5f0f\u4e8c&#xff1a;Volumes (\u6570\u636e\u5377)<\/h5>\n<ul>\n<li>\u901a\u4fd7\u89e3\u91ca&#xff1a;\u201cDocker \u6258\u7ba1\u7684\u79c1\u6709\u4fdd\u9669\u7bb1\u201d\u3002<\/li>\n<li>\u539f\u7406&#xff1a;Docker \u5728\u786c\u76d8\u6df1\u5904\u5212\u4e86\u4e00\u5757\u5730\u76d8&#xff08;\u4f60\u901a\u5e38\u4e0d\u7528\u7ba1\u5728\u54ea&#xff09;&#xff0c;\u4e13\u95e8\u7528\u6765\u5b58\u6570\u636e\u3002<\/li>\n<li>\u573a\u666f&#xff1a;\u6570\u636e\u5e93\u6700\u5e38\u7528&#xff01;\n<ul>\n<li>\u8fd0\u884c MySQL\u3001Redis \u65f6&#xff0c;\u628a\u6570\u636e\u6587\u4ef6\u5b58\u5728 Volume \u91cc\u3002\u5b89\u5168\u3001\u597d\u7ba1\u7406\u3001\u8fc1\u79fb\u65b9\u4fbf\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<h4>\u5b9e\u6218\u6f14\u793a&#xff1a;\u4f53\u9a8c\u201c\u70ed\u66f4\u65b0\u201d (Bind Mount)<\/h4>\n<p>\u6211\u4eec\u7528\u521a\u624d\u7684 Python \u7f51\u7ad9\u6765\u4f53\u9a8c\u4e00\u4e0b Bind Mount \u7684\u5a01\u529b\u3002<\/p>\n<p>\u76ee\u6807&#xff1a;\u6211\u4eec\u4fee\u6539\u7535\u8111\u4e0a\u7684 app.py&#xff0c;\u6d4f\u89c8\u5668\u91cc\u7684\u7f51\u9875\u5185\u5bb9\u8981\u7acb\u523b\u53d8&#xff0c;\u4e0d\u9700\u8981\u91cd\u65b0\u6784\u5efa\u955c\u50cf\u3002<\/p>\n<h5>\u7b2c\u4e00\u6b65&#xff1a;\u6e05\u7406\u6218\u573a<\/h5>\n<p>\u5148\u628a\u4e4b\u524d\u8dd1\u7684\u5bb9\u5668\u505c\u6389\u5220\u6389&#xff08;\u5982\u679c\u8fd8\u5728\u8dd1\u7684\u8bdd&#xff09;&#xff1a;<\/p>\n<p><span class=\"token function\">docker<\/span> <span class=\"token function\">rm<\/span> -f my-website<\/p>\n<p>(\u6ce8\u610f&#xff1a;\u8fd9\u6b21\u6211\u4eec\u7528\u4e86 -f \u5f3a\u5236\u5220\u9664&#xff0c;\u7701\u53bb stop \u7684\u6b65\u9aa4&#xff0c;\u65b9\u4fbf\u5427&#xff1f;)<\/p>\n<h5>\u7b2c\u4e8c\u6b65&#xff1a;\u6302\u8f7d\u542f\u52a8<\/h5>\n<p>\u8bf7\u786e\u4fdd\u4f60\u7684\u7ec8\u7aef\u8fd8\u5728 docker-demo \u6587\u4ef6\u5939\u91cc&#xff08;\u91cc\u9762\u6709 app.py&#xff09;\u3002<\/p>\n<p>\u8bf7\u6839\u636e\u4f60\u7684\u7cfb\u7edf\u9009\u62e9\u547d\u4ee4&#xff1a;<\/p>\n<p>&#x1f4bb; Windows (PowerShell):<\/p>\n<p>docker run <span class=\"token operator\">&#8211;<\/span>d <span class=\"token operator\">&#8211;<\/span>p 8080:5000 <span class=\"token operator\">&#8211;<\/span>v $<span class=\"token punctuation\">{<\/span><span class=\"token function\">PWD<\/span><span class=\"token punctuation\">}<\/span>:<span class=\"token operator\">\/<\/span>app <span class=\"token operator\">&#8212;<\/span>name my-website my-web-app<\/p>\n<p>&#x1f4bb; Windows (CMD) \/ &#x1f34e; Mac \/ &#x1f427; Linux:<\/p>\n<p><span class=\"token function\">docker<\/span> run -d -p <span class=\"token number\">8080<\/span>:5000 -v <span class=\"token string\">&#034;<span class=\"token variable\"><span class=\"token variable\">$(<\/span><span class=\"token builtin class-name\">pwd<\/span><span class=\"token variable\">)<\/span><\/span>&#034;<\/span>:\/app &#8211;name my-website my-web-app<\/p>\n<p>(\u5982\u679c Windows CMD \u62a5\u9519&#xff0c;\u628a $(pwd) \u6362\u6210 %cd% \u8bd5\u8bd5)<\/p>\n<p>\u547d\u4ee4\u6838\u5fc3\u89e3\u6790&#xff1a;-v<\/p>\n<ul>\n<li>-v &lt;\u5bbf\u4e3b\u673a\u8def\u5f84&gt;:&lt;\u5bb9\u5668\u8def\u5f84&gt;<\/li>\n<li>\u8fd9\u91cc\u7684\u610f\u601d\u662f&#xff1a;\u628a\u6211\u5f53\u524d\u7535\u8111\u7684\u76ee\u5f55 (pwd)&#xff0c;\u6302\u8f7d\u5230\u5bb9\u5668\u91cc\u7684 \/app \u76ee\u5f55\u3002<\/li>\n<li>\u8fd9\u6837&#xff0c;\u5bb9\u5668\u91cc\u7684 app.py \u5c31\u4e0d\u518d\u662f\u955c\u50cf\u91cc\u90a3\u4e2a\u65e7\u7684\u4e86&#xff0c;\u800c\u662f\u76f4\u63a5\u8bfb\u53d6\u4f60\u7535\u8111\u4e0a\u7684\u8fd9\u4e2a\u6587\u4ef6&#xff01;<\/li>\n<\/ul>\n<h5>\u7b2c\u4e09\u6b65&#xff1a;\u89c1\u8bc1\u5947\u8ff9<\/h5>\n<li>\u6253\u5f00\u6d4f\u89c8\u5668\u8bbf\u95ee http:\/\/localhost:8080&#xff0c;\u4f60\u5e94\u8be5\u770b\u5230\u4e4b\u524d\u7684 Hello \u5185\u5bb9\u3002<\/li>\n<li>\u4e0d\u8981\u5173\u6d4f\u89c8\u5668&#xff0c;\u4e5f\u4e0d\u8981\u52a8 Docker\u3002<\/li>\n<li>\u6253\u5f00\u4f60\u7684\u4ee3\u7801\u7f16\u8f91\u5668&#xff0c;\u4fee\u6539\u7535\u8111\u4e0a\u7684 app.py\u3002 \u628a&#xff1a; return &#039;&lt;h1&gt;Hello! \u8fd9\u662f\u6211\u7528 Docker \u6784\u5efa\u7684\u7b2c\u4e00\u4e2a\u7f51\u7ad9&#xff01;&#x1f389;&lt;\/h1&gt;&#039; \u6539\u6210&#xff1a; return &#039;&lt;h1&gt;\u54c7&#xff01;\u6211\u4fee\u6539\u4e86\u4ee3\u7801&#xff0c;\u7f51\u9875\u76f4\u63a5\u53d8\u4e86&#xff01;&#x1f525;&lt;\/h1&gt;&#039;<\/li>\n<li>\u4fdd\u5b58\u6587\u4ef6\u3002<\/li>\n<li>\u56de\u5230\u6d4f\u89c8\u5668&#xff0c;\u5237\u65b0\u9875\u9762\u3002<\/li>\n<p>\u4f60\u4f1a\u53d1\u73b0&#xff1a;\u7f51\u9875\u5185\u5bb9\u53d8\u4e86&#xff01; \u4e0d\u9700\u8981 docker build&#xff0c;\u4e5f\u4e0d\u9700\u8981 docker restart\u3002\u8fd9\u5c31\u662f\u5f00\u53d1\u795e\u5668 Bind Mount\u3002<\/p>\n<hr \/>\n<h4>\u5c0f\u7ed3<\/h4>\n<li>\u5bb9\u5668\u91cc\u7684\u6570\u636e\u662f\u4e34\u65f6\u7684&#xff0c;\u5220\u4e86\u5c31\u6ca1\u4e86\u3002<\/li>\n<li>Bind Mount (-v \u8def\u5f84:\u8def\u5f84)&#xff1a;\u9002\u5408\u4ee3\u7801\u5f00\u53d1&#xff0c;\u5bbf\u4e3b\u673a\u548c\u5bb9\u5668\u5b9e\u65f6\u540c\u6b65\u3002<\/li>\n<li>Volume&#xff1a;\u9002\u5408\u5b58\u6570\u636e\u5e93\u6587\u4ef6&#xff0c;\u4ea4\u7ed9 Docker \u7ba1\u7406&#xff08;\u540e\u9762\u8bb2\u6570\u636e\u5e93\u5b9e\u6218\u4f1a\u7528\u5230&#xff09;\u3002<\/li>\n<hr \/>\n<p>\u5982\u679c\u4f60\u7684\u7f51\u9875\u6210\u529f\u5b9e\u73b0\u4e86\u201c\u70ed\u66f4\u65b0\u201d&#xff0c;\u6211\u4eec\u6765\u89e3\u5bc6\u90a3\u4e2a\u795e\u79d8\u7684 -p 8080:5000 \u5230\u5e95\u662f\u5728\u5e72\u4ec0\u4e48&#xff08;\u7f51\u7edc\u7aef\u53e3&#xff09;\u3002<\/p>\n<hr \/>\n<p>\u6211\u4eec\u8fdb\u5165 4.2\u3002<\/p>\n<p>\u8fd9\u4e00\u8282\u8981\u63ed\u5f00\u4e00\u76f4\u4ee5\u6765\u90a3\u4e2a\u795e\u79d8\u53c2\u6570 -p \u7684\u9762\u7eb1&#xff0c;\u5e76\u4e14\u89e3\u7b54\u4e00\u4e2a\u8ba9\u65e0\u6570\u65b0\u624b\u649e\u5899\u7684\u95ee\u9898&#xff1a;\u201c\u6211\u7684\u4ee3\u7801\u91cc\u5199 localhost \u4e3a\u4ec0\u4e48\u8fde\u4e0d\u4e0a\u6570\u636e\u5e93&#xff1f;\u201d<\/p>\n<hr \/>\n<h4>4.2 \u5bb9\u5668\u7f51\u7edc (Networking)<\/h4>\n<p>Docker \u7684\u7f51\u7edc\u5c31\u50cf\u4e00\u4e2a\u5de8\u5927\u7684\u9152\u5e97\u3002<\/p>\n<ul>\n<li>\u5bbf\u4e3b\u673a (Host)&#xff1a;\u662f\u9152\u5e97\u5927\u5802&#xff08;\u516c\u7f51\/\u4f60\u7684\u7535\u8111&#xff09;\u3002<\/li>\n<li>\u5bb9\u5668 (Container)&#xff1a;\u662f\u72ec\u7acb\u7684\u5ba2\u623f\u3002<\/li>\n<\/ul>\n<h5>1. \u7aef\u53e3\u6620\u5c04&#xff1a;\u6253\u901a\u201c\u5185\u7ebf\u7535\u8bdd\u201d (-p)<\/h5>\n<p>\u95ee\u9898&#xff1a; \u4f60\u5728\u5bb9\u5668&#xff08;\u5ba2\u623f 101&#xff09;\u91cc\u542f\u52a8\u4e86\u4e00\u4e2a\u7f51\u9875\u670d\u52a1&#xff0c;\u76d1\u542c\u7aef\u53e3 5000\u3002 \u4f46\u662f&#xff0c;\u5982\u679c\u4f60\u5728\u7535\u8111&#xff08;\u5927\u5802&#xff09;\u6253\u5f00\u6d4f\u89c8\u5668\u8bbf\u95ee localhost:5000&#xff0c;\u662f\u6253\u4e0d\u5f00\u7684\u3002<\/p>\n<p>\u539f\u56e0&#xff1a; \u5bb9\u5668\u662f\u9694\u79bb\u7684\u3002\u5ba2\u623f\u91cc\u7684\u7535\u8bdd\u53ea\u80fd\u5728\u5ba2\u623f\u91cc\u54cd&#xff0c;\u5927\u5802\u542c\u4e0d\u5230\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6848&#xff1a;\u7aef\u53e3\u6620\u5c04 (-p) \u4f60\u9700\u8981\u544a\u8bc9\u524d\u53f0&#xff1a;\u201c\u5982\u679c\u6709\u4eba\u6253\u5927\u5802\u7684 8080 \u53f7\u7535\u8bdd&#xff0c;\u8bf7\u8f6c\u63a5\u5230 101 \u623f\u95f4\u7684 5000 \u53f7 \u5206\u673a\u3002\u201d<\/p>\n<p>\u547d\u4ee4\u89e3\u6790&#xff1a;<\/p>\n<p><span class=\"token function\">docker<\/span> run -p <span class=\"token number\">8080<\/span>:5000 <span class=\"token punctuation\">..<\/span>.<\/p>\n<ul>\n<li>\u5192\u53f7\u5de6\u8fb9 (8080)&#xff1a;\u5bbf\u4e3b\u673a\u7aef\u53e3&#xff08;\u4f60\u7535\u8111\u5bf9\u5916\u5f00\u653e\u7684\u53e3&#xff09;\u3002<\/li>\n<li>\u5192\u53f7\u53f3\u8fb9 (5000)&#xff1a;\u5bb9\u5668\u7aef\u53e3&#xff08;\u7a0b\u5e8f\u91cc\u5199\u6b7b\u7684\u53e3&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u5e38\u89c1\u8bef\u533a&#xff1a;<\/p>\n<ul>\n<li>\u5982\u679c\u4f60\u7a0b\u5e8f\u91cc\u5199\u7684\u662f app.run(port&#061;3000)&#xff0c;\u90a3\u4f60\u53f3\u8fb9\u5fc5\u987b\u5199 3000\u3002<\/li>\n<li>\u5de6\u8fb9\u53ef\u4ee5\u968f\u4fbf\u6539&#xff08;\u53ea\u8981\u4e0d\u51b2\u7a81&#xff09;\u3002\u6bd4\u5982 -p 80:5000&#xff0c;\u90a3\u4f60\u8bbf\u95ee localhost \u5c31\u80fd\u76f4\u63a5\u770b\u7f51\u9875&#xff0c;\u4e0d\u7528\u8f93\u7aef\u53e3\u53f7\u4e86&#xff08;\u6d4f\u89c8\u5668\u9ed8\u8ba4 80&#xff09;\u3002<\/li>\n<\/ul>\n<hr \/>\n<h5>2. \u5bb9\u5668\u4e92\u8fde&#xff1a;\u6700\u5927\u7684\u201c\u5751\u201d (Localhost Trap)<\/h5>\n<p>\u8fd9\u662f\u672c\u8282\u6700\u6838\u5fc3\u7684\u77e5\u8bc6\u70b9&#xff0c;\u8bf7\u4ed4\u7ec6\u770b\u3002<\/p>\n<p>\u573a\u666f&#xff1a; \u4f60\u8d77\u4e86\u4e00\u4e2a Web \u5bb9\u5668&#xff0c;\u53c8\u8d77\u4e86\u4e00\u4e2a MySQL \u6570\u636e\u5e93\u5bb9\u5668\u3002 \u4f60\u5728 Web \u4ee3\u7801\u91cc\u8fde\u63a5\u6570\u636e\u5e93&#xff0c;\u5730\u5740\u5199\u7684\u662f&#xff1a;connect(&#039;localhost&#039;, 3306)\u3002 \u7ed3\u679c&#xff1a;\u62a5\u9519&#xff01;\u8fde\u63a5\u5931\u8d25&#xff01;<\/p>\n<p>\u4e3a\u4ec0\u4e48&#xff1f;<\/p>\n<ul>\n<li>\u5728 Web \u5bb9\u5668\u91cc&#xff0c;localhost \u6307\u7684\u662f Web \u5bb9\u5668\u81ea\u5df1&#xff01;<\/li>\n<li>\u5b83\u4f1a\u5728\u81ea\u5df1\u8fd9\u4e2a\u5c0f\u76d2\u5b50\u91cc\u627e 3306 \u7aef\u53e3&#xff0c;\u5f53\u7136\u627e\u4e0d\u5230&#xff08;\u56e0\u4e3a MySQL \u5728\u53e6\u4e00\u4e2a\u76d2\u5b50\u91cc&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u6b63\u786e\u505a\u6cd5&#xff1a;\u4f7f\u7528 Docker Network<\/p>\n<p>Docker \u5141\u8bb8\u4f60\u521b\u5efa\u4e00\u4e2a\u865a\u62df\u7684\u5c40\u57df\u7f51 (Bridge Network)\u3002 \u53ea\u8981\u4e24\u4e2a\u5bb9\u5668\u90fd\u5728\u540c\u4e00\u4e2a\u7f51\u7edc\u91cc&#xff0c;\u5b83\u4eec\u5c31\u53ef\u4ee5\u901a\u8fc7\u201c\u540d\u5b57\u201d\u4e92\u76f8\u8bbf\u95ee\u3002<\/p>\n<p>\u539f\u7406\u56fe&#xff1a;<\/p>\n<p>  #mermaid-svg-6N54APHDqj8Zisa3{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-6N54APHDqj8Zisa3 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-6N54APHDqj8Zisa3 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-6N54APHDqj8Zisa3 .error-icon{fill:#552222;}#mermaid-svg-6N54APHDqj8Zisa3 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-6N54APHDqj8Zisa3 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-6N54APHDqj8Zisa3 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-6N54APHDqj8Zisa3 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-6N54APHDqj8Zisa3 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-6N54APHDqj8Zisa3 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-6N54APHDqj8Zisa3 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-6N54APHDqj8Zisa3 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-6N54APHDqj8Zisa3 .marker.cross{stroke:#333333;}#mermaid-svg-6N54APHDqj8Zisa3 svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-6N54APHDqj8Zisa3 p{margin:0;}#mermaid-svg-6N54APHDqj8Zisa3 .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-6N54APHDqj8Zisa3 .cluster-label text{fill:#333;}#mermaid-svg-6N54APHDqj8Zisa3 .cluster-label span{color:#333;}#mermaid-svg-6N54APHDqj8Zisa3 .cluster-label span p{background-color:transparent;}#mermaid-svg-6N54APHDqj8Zisa3 .label text,#mermaid-svg-6N54APHDqj8Zisa3 span{fill:#333;color:#333;}#mermaid-svg-6N54APHDqj8Zisa3 .node rect,#mermaid-svg-6N54APHDqj8Zisa3 .node circle,#mermaid-svg-6N54APHDqj8Zisa3 .node ellipse,#mermaid-svg-6N54APHDqj8Zisa3 .node polygon,#mermaid-svg-6N54APHDqj8Zisa3 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-6N54APHDqj8Zisa3 .rough-node .label text,#mermaid-svg-6N54APHDqj8Zisa3 .node .label text,#mermaid-svg-6N54APHDqj8Zisa3 .image-shape .label,#mermaid-svg-6N54APHDqj8Zisa3 .icon-shape .label{text-anchor:middle;}#mermaid-svg-6N54APHDqj8Zisa3 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-6N54APHDqj8Zisa3 .rough-node .label,#mermaid-svg-6N54APHDqj8Zisa3 .node .label,#mermaid-svg-6N54APHDqj8Zisa3 .image-shape .label,#mermaid-svg-6N54APHDqj8Zisa3 .icon-shape .label{text-align:center;}#mermaid-svg-6N54APHDqj8Zisa3 .node.clickable{cursor:pointer;}#mermaid-svg-6N54APHDqj8Zisa3 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-6N54APHDqj8Zisa3 .arrowheadPath{fill:#333333;}#mermaid-svg-6N54APHDqj8Zisa3 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-6N54APHDqj8Zisa3 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-6N54APHDqj8Zisa3 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-6N54APHDqj8Zisa3 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-6N54APHDqj8Zisa3 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-6N54APHDqj8Zisa3 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-6N54APHDqj8Zisa3 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-6N54APHDqj8Zisa3 .cluster text{fill:#333;}#mermaid-svg-6N54APHDqj8Zisa3 .cluster span{color:#333;}#mermaid-svg-6N54APHDqj8Zisa3 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-6N54APHDqj8Zisa3 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-6N54APHDqj8Zisa3 rect.text{fill:none;stroke-width:0;}#mermaid-svg-6N54APHDqj8Zisa3 .icon-shape,#mermaid-svg-6N54APHDqj8Zisa3 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-6N54APHDqj8Zisa3 .icon-shape p,#mermaid-svg-6N54APHDqj8Zisa3 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-6N54APHDqj8Zisa3 .icon-shape rect,#mermaid-svg-6N54APHDqj8Zisa3 .image-shape rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-6N54APHDqj8Zisa3 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-6N54APHDqj8Zisa3 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-6N54APHDqj8Zisa3 :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u5bb9\u5668B<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>\u5bb9\u5668A<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"edgeLabel\"><\/p>\n<p>Docker\u7f51\u7edc<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>webapp<\/p>\n<p><\/span><\/p>\n<p>         <span class=\"nodeLabel\"><\/p>\n<p>mysql<\/p>\n<p><\/span><\/p>\n<p>\u4f60\u53ea\u9700\u8981\u5728\u4ee3\u7801\u91cc\u628a localhost \u6362\u6210 mysql&#xff08;\u5bf9\u65b9\u5bb9\u5668\u7684\u540d\u5b57&#xff09;&#xff0c;Docker \u5c31\u4f1a\u81ea\u52a8\u901a\u8fc7\u5185\u7f6e\u7684 DNS \u5e2e\u4f60\u627e\u5230\u5b83\u7684 IP \u5730\u5740\u3002<\/p>\n<hr \/>\n<h4>\u624b\u52a8\u6f14\u793a&#xff08;\u4e86\u89e3\u539f\u7406\u5373\u53ef&#xff09;<\/h4>\n<p>\u867d\u7136\u6211\u4eec\u5728\u4e0b\u4e00\u7ae0&#xff08;Docker Compose&#xff09;\u624d\u4f1a\u5927\u91cf\u4f7f\u7528\u7f51\u7edc&#xff0c;\u4f46\u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u7b80\u5355\u4f53\u9a8c\u4e00\u4e0b\u201c\u901a\u8fc7\u540d\u5b57 ping \u901a\u5bf9\u65b9\u201d\u3002<\/p>\n<h5>1. \u521b\u5efa\u4e00\u4e2a\u7f51\u7edc<\/h5>\n<p>\u6211\u4eec\u8981\u5efa\u4e00\u4e2a\u4e13\u95e8\u7684\u201c\u804a\u5929\u5ba4\u201d\u3002<\/p>\n<p><span class=\"token function\">docker<\/span> network create my-net<\/p>\n<h5>2. \u542f\u52a8\u4e24\u4e2a\u5bb9\u5668\u52a0\u5165\u8fd9\u4e2a\u7f51\u7edc<\/h5>\n<p>\u6211\u4eec\u542f\u52a8\u4e24\u4e2a\u6781\u7b80\u7684 Linux (Alpine) \u5bb9\u5668&#xff0c;\u5206\u522b\u53eb box1 \u548c box2&#xff0c;\u5e76\u628a\u5b83\u4eec\u63d2\u5230 my-net \u4e0a\u3002<\/p>\n<p>\u6253\u5f00\u7ec8\u7aef\u7a97\u53e3 1&#xff1a;<\/p>\n<p><span class=\"token function\">docker<\/span> run -it &#8211;name box1 &#8211;network my-net alpine <span class=\"token function\">sh<\/span><\/p>\n<p>(\u4f60\u73b0\u5728\u8fdb\u5165\u4e86 box1 \u5185\u90e8)<\/p>\n<p>\u6253\u5f00\u7ec8\u7aef\u7a97\u53e3 2&#xff1a;<\/p>\n<p><span class=\"token function\">docker<\/span> run -it &#8211;name box2 &#8211;network my-net alpine <span class=\"token function\">sh<\/span><\/p>\n<p>(\u4f60\u73b0\u5728\u8fdb\u5165\u4e86 box2 \u5185\u90e8)<\/p>\n<h5>3. \u4e92\u76f8 Ping (\u89c1\u8bc1\u5947\u8ff9)<\/h5>\n<p>\u5728 box1 (\u7a97\u53e3 1) \u91cc\u8f93\u5165&#xff1a;<\/p>\n<p><span class=\"token function\">ping<\/span> box2<\/p>\n<p>\u4f60\u4f1a\u770b\u5230\u7c7b\u4f3c\u8fd9\u6837\u7684\u8f93\u51fa&#xff1a; PING box2 (172.18.0.3): 56 data bytes&#8230;<\/p>\n<p>\u8fd9\u610f\u5473\u7740&#xff1a; \u4f60\u5e76\u6ca1\u6709\u8f93\u5165 IP \u5730\u5740&#xff0c;\u53ea\u662f\u558a\u4e86\u5bf9\u65b9\u7684\u540d\u5b57 box2&#xff0c;Docker \u5c31\u81ea\u52a8\u5e2e\u4f60\u89e3\u6790\u5230\u4e86\u5b83\u7684 IP&#xff0c;\u5e76\u4e14\u8fde\u901a\u4e86&#xff01;<\/p>\n<hr \/>\n<h4>\u603b\u7ed3 4.2<\/h4>\n<li>\u5bf9\u5916\u4ea4\u6d41&#xff1a;\u7528 -p \u5bbf\u4e3b\u673a\u7aef\u53e3:\u5bb9\u5668\u7aef\u53e3\u3002<\/li>\n<li>\u5bf9\u5185\u4ea4\u6d41&#xff1a;\u4e0d\u8981\u7528 localhost&#xff01;\u8981\u521b\u5efa\u4e00\u4e2a\u7f51\u7edc (docker network create)&#xff0c;\u7136\u540e\u7528\u5bb9\u5668\u540d\u5b57\u4e92\u76f8\u8bbf\u95ee\u3002<\/li>\n<hr \/>\n<p>\u8fd9\u4e2a\u65f6\u5019&#xff0c;\u4f60\u53ef\u80fd\u4f1a\u89c9\u5f97&#xff1a; \u201c\u8fd9\u4e5f\u592a\u9ebb\u70e6\u4e86\u5427&#xff1f;\u6bcf\u6b21\u90fd\u8981\u624b\u52a8\u521b\u5efa\u7f51\u7edc&#xff0c;\u542f\u52a8\u5bb9\u5668\u8fd8\u8981\u6572\u90a3\u4e48\u957f\u4e00\u4e32\u547d\u4ee4&#xff1a;-d -p &#8230; -v &#8230; &#8211;network &#8230; &#8211;name &#8230;&#xff0c;\u4e07\u4e00\u6211\u6709 10 \u4e2a\u5bb9\u5668\u600e\u4e48\u529e&#xff1f;\u201d<\/p>\n<p>\u4f60\u8bf4\u5f97\u5bf9&#xff01; \u8fd9\u79cd\u7e41\u7410\u7684\u624b\u5de5\u64cd\u4f5c\u53ea\u9002\u5408\u5b66\u4e60\u539f\u7406\u3002 \u5728\u5b9e\u9645\u5de5\u4f5c\u4e2d&#xff0c;\u6211\u4eec\u6709\u66f4\u4f18\u96c5\u7684\u5168\u81ea\u52a8\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<p>\u51c6\u5907\u597d\u8fdb\u5165 Docker \u6700\u8212\u670d\u7684\u7ae0\u8282\u4e86\u5417&#xff1f; \u6211\u4eec\u8981\u4ecb\u7ecd\u5927\u6740\u5668 \u2014\u2014 Docker Compose&#xff01;<\/p>\n<hr \/>\n<p>\u7b2c\u4e94\u9636\u6bb5&#xff1a;\u591a\u5bb9\u5668\u7f16\u6392 (Docker Compose \u7bc7)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b22\u8fce\u6765\u5230\u7b2c\u56db\u9636\u6bb5&#xff1a;\u8fdb\u9636\u7bc7\u3002<br \/>\n\u5982\u679c\u8bf4\u524d\u4e09\u4e2a\u9636\u6bb5\u662f\u8ba9\u4f60\u5b66\u4f1a\u201c\u628a\u7a0b\u5e8f\u8dd1\u8d77\u6765\u201d&#xff0c;\u90a3\u8fd9\u4e2a\u9636\u6bb5\u5c31\u662f\u8981\u89e3\u51b3\u4e24\u4e2a\u6700\u6838\u5fc3\u7684\u751f\u4ea7\u95ee\u9898&#xff1a;\u201c\u6570\u636e\u5b58\u54ea&#xff1f;\u201d \u548c \u201c\u600e\u4e48\u8054\u7f51&#xff1f;\u201d<br \/>\n\u5148\u770b 4.1&#xff0c;\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u75db\u7684\u9886\u609f\u3002 4.1 \u6570\u636e\u6301\u4e45\u5316 (Data Persistence)<br \/>\n1. \u4e00\u4e2a\u53ef\u6015\u7684\u4e8b\u5b9e<br \/>\n\u8fd8\u8bb0\u5f97\u6211\u4eec\u4e4b\u524d\u8bf4\u7684\u5417&#xff1f;\u5bb9\u5668\u662f\u201c\u80f6\u56ca\u516c\u5bd3\u201d\u3002 \u5f53\u4f60\u5220\u9664\u4e00\u4e2a\u5bb9\u5668 (docker rm)&#xff0c;\u4f60\u5728\u5bb9<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[27,78],"topic":[],"class_list":["post-62457","post","type-post","status-publish","format-standard","hentry","category-server","tag-docker","tag-78"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7b2c\u56db\u9636\u6bb5\uff1a\u6570\u636e\u4e0e\u7f51\u7edc (\u8fdb\u9636\u7bc7) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/62457.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7b2c\u56db\u9636\u6bb5\uff1a\u6570\u636e\u4e0e\u7f51\u7edc (\u8fdb\u9636\u7bc7) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6b22\u8fce\u6765\u5230\u7b2c\u56db\u9636\u6bb5&#xff1a;\u8fdb\u9636\u7bc7\u3002 \u5982\u679c\u8bf4\u524d\u4e09\u4e2a\u9636\u6bb5\u662f\u8ba9\u4f60\u5b66\u4f1a\u201c\u628a\u7a0b\u5e8f\u8dd1\u8d77\u6765\u201d&#xff0c;\u90a3\u8fd9\u4e2a\u9636\u6bb5\u5c31\u662f\u8981\u89e3\u51b3\u4e24\u4e2a\u6700\u6838\u5fc3\u7684\u751f\u4ea7\u95ee\u9898&#xff1a;\u201c\u6570\u636e\u5b58\u54ea&#xff1f;\u201d \u548c \u201c\u600e\u4e48\u8054\u7f51&#xff1f;\u201d \u5148\u770b 4.1&#xff0c;\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u75db\u7684\u9886\u609f\u3002 4.1 \u6570\u636e\u6301\u4e45\u5316 (Data Persistence) 1. \u4e00\u4e2a\u53ef\u6015\u7684\u4e8b\u5b9e \u8fd8\u8bb0\u5f97\u6211\u4eec\u4e4b\u524d\u8bf4\u7684\u5417&#xff1f;\u5bb9\u5668\u662f\u201c\u80f6\u56ca\u516c\u5bd3\u201d\u3002 \u5f53\u4f60\u5220\u9664\u4e00\u4e2a\u5bb9\u5668 (docker rm)&#xff0c;\u4f60\u5728\u5bb9\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/62457.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-19T16:34:09+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/62457.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/62457.html\",\"name\":\"\u7b2c\u56db\u9636\u6bb5\uff1a\u6570\u636e\u4e0e\u7f51\u7edc (\u8fdb\u9636\u7bc7) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-19T16:34:09+00:00\",\"dateModified\":\"2026-01-19T16:34:09+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/62457.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/62457.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/62457.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7b2c\u56db\u9636\u6bb5\uff1a\u6570\u636e\u4e0e\u7f51\u7edc (\u8fdb\u9636\u7bc7)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u7b2c\u56db\u9636\u6bb5\uff1a\u6570\u636e\u4e0e\u7f51\u7edc (\u8fdb\u9636\u7bc7) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/62457.html","og_locale":"zh_CN","og_type":"article","og_title":"\u7b2c\u56db\u9636\u6bb5\uff1a\u6570\u636e\u4e0e\u7f51\u7edc (\u8fdb\u9636\u7bc7) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6b22\u8fce\u6765\u5230\u7b2c\u56db\u9636\u6bb5&#xff1a;\u8fdb\u9636\u7bc7\u3002 \u5982\u679c\u8bf4\u524d\u4e09\u4e2a\u9636\u6bb5\u662f\u8ba9\u4f60\u5b66\u4f1a\u201c\u628a\u7a0b\u5e8f\u8dd1\u8d77\u6765\u201d&#xff0c;\u90a3\u8fd9\u4e2a\u9636\u6bb5\u5c31\u662f\u8981\u89e3\u51b3\u4e24\u4e2a\u6700\u6838\u5fc3\u7684\u751f\u4ea7\u95ee\u9898&#xff1a;\u201c\u6570\u636e\u5b58\u54ea&#xff1f;\u201d \u548c \u201c\u600e\u4e48\u8054\u7f51&#xff1f;\u201d \u5148\u770b 4.1&#xff0c;\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u75db\u7684\u9886\u609f\u3002 4.1 \u6570\u636e\u6301\u4e45\u5316 (Data Persistence) 1. \u4e00\u4e2a\u53ef\u6015\u7684\u4e8b\u5b9e \u8fd8\u8bb0\u5f97\u6211\u4eec\u4e4b\u524d\u8bf4\u7684\u5417&#xff1f;\u5bb9\u5668\u662f\u201c\u80f6\u56ca\u516c\u5bd3\u201d\u3002 \u5f53\u4f60\u5220\u9664\u4e00\u4e2a\u5bb9\u5668 (docker rm)&#xff0c;\u4f60\u5728\u5bb9","og_url":"https:\/\/www.wsisp.com\/helps\/62457.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-19T16:34:09+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/62457.html","url":"https:\/\/www.wsisp.com\/helps\/62457.html","name":"\u7b2c\u56db\u9636\u6bb5\uff1a\u6570\u636e\u4e0e\u7f51\u7edc (\u8fdb\u9636\u7bc7) - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-19T16:34:09+00:00","dateModified":"2026-01-19T16:34:09+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/62457.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/62457.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/62457.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u7b2c\u56db\u9636\u6bb5\uff1a\u6570\u636e\u4e0e\u7f51\u7edc (\u8fdb\u9636\u7bc7)"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/62457","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=62457"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/62457\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=62457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=62457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=62457"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=62457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}