{"id":107,"date":"2026-05-05T12:43:57","date_gmt":"2026-05-05T04:43:57","guid":{"rendered":"https:\/\/tachyoncat.top\/?p=107"},"modified":"2026-05-05T12:43:59","modified_gmt":"2026-05-05T04:43:59","slug":"docker-%e6%9c%8d%e5%8a%a1%e7%ae%a1%e7%90%86%e4%b8%8e%e5%86%85%e5%ad%98%e4%bc%98%e5%8c%96%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/tachyoncat.top\/index.php\/2026\/05\/05\/docker-%e6%9c%8d%e5%8a%a1%e7%ae%a1%e7%90%86%e4%b8%8e%e5%86%85%e5%ad%98%e4%bc%98%e5%8c%96%e6%8c%87%e5%8d%97\/","title":{"rendered":"Docker \u670d\u52a1\u7ba1\u7406\u4e0e\u5185\u5b58\u4f18\u5316\u6307\u5357"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5728\u4f4e\u5185\u5b58\uff08\u59821\u68382G\uff09\u7684\u4e91\u670d\u52a1\u5668\u4e0a\uff0cDocker \u53ca\u5176\u5b88\u62a4\u8fdb\u7a0b\uff08dockerd\u3001containerd\uff09\u5373\u4f7f\u5728\u6ca1\u6709\u8fd0\u884c\u5bb9\u5668\u65f6\u4e5f\u4f1a\u5360\u7528\u7ea6 100MB-150MB \u7684\u5185\u5b58\u3002\u4e3a\u4e86\u7ed9 Web \u670d\u52a1\uff08\u5982 PHP\/MySQL\uff09\u817e\u51fa\u7a7a\u95f4\uff0c\u6211\u4eec\u53ef\u4ee5\u624b\u52a8\u7ba1\u7406 Docker \u7684\u5f00\u5173\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. \u5173\u95ed Docker (\u91ca\u653e\u5185\u5b58)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f53\u4f60\u6682\u65f6\u4e0d\u9700\u8981\u4f7f\u7528 Docker \u5bb9\u5668\u65f6\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b8c\u5168\u505c\u6b62\u76f8\u5173\u670d\u52a1\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-d2d689f33969694e85a3d8362a078b0f\"><code># 1. \u505c\u6b62\u670d\u52a1\nsudo systemctl stop docker docker.socket containerd\n\n# 2. \u7981\u6b62\u5f00\u673a\u81ea\u542f\nsudo systemctl disable docker docker.socket containerd\n\n# 3. \u5f7b\u5e95\u5c4f\u853d\uff08\u53ef\u9009\uff1a\u9632\u6b62\u88ab\u5176\u4ed6\u670d\u52a1\u610f\u5916\u5524\u9192\uff0c\u6700\u7701\u5185\u5b58\u7684\u64cd\u4f5c\uff09\n# \u5982\u679c\u4f60\u4e4b\u524d\u6267\u884c\u8fc7\u8fd9\u6b65\uff0c\u5f00\u542f\u65f6\u5fc5\u987b unmask\nsudo systemctl mask docker docker.socket containerd<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2. \u5f00\u542f Docker (\u6062\u590d\u4f7f\u7528)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f53\u9700\u8981\u8fd0\u884c Docker \u5bb9\u5668\u65f6\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6062\u590d\u670d\u52a1\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-b57b52bb3168a8ad5a160de60bf80153\"><code># 1. \u89e3\u9664\u5c4f\u853d\uff08\u9632\u6b62\u4e4b\u524d\u6267\u884c\u4e86 mask\uff09\nsudo systemctl unmask docker docker.socket containerd\n\n# 2. \u542f\u52a8\u670d\u52a1\nsudo systemctl start containerd\nsudo systemctl start docker\n\n# 3. \u8bbe\u7f6e\u5f00\u673a\u81ea\u542f\uff08\u53ef\u9009\uff09\nsudo systemctl enable docker docker.socket containerd\n\n# 4. \u9a8c\u8bc1\u662f\u5426\u542f\u52a8\u6210\u529f\ndocker ps<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u5e38\u7528\u5bb9\u5668\u7ba1\u7406\u547d\u4ee4<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f00\u542f Docker \u670d\u52a1\u540e\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u7ba1\u7406\u5177\u4f53\u7684\u5bb9\u5668\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u67e5\u770b\u5bb9\u5668\u72b6\u6001<\/h3>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-2ed12757c238cb9e6346ea307a5f1a45\"><code># \u67e5\u770b\u6b63\u5728\u8fd0\u884c\u7684\u5bb9\u5668\ndocker ps\n\n# \u67e5\u770b\u6240\u6709\u5bb9\u5668\uff08\u5305\u62ec\u5df2\u505c\u6b62\u7684\uff09\ndocker ps -a<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u542f\u52a8\/\u505c\u6b62\u7279\u5b9a\u5bb9\u5668<\/h3>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-c10d908dc6e05db2d62f9828ad03b54c\"><code># \u542f\u52a8\u540d\u4e3a my_app \u7684\u5bb9\u5668\ndocker start &#91;\u5bb9\u5668ID\u6216\u540d\u79f0]\n\n# \u505c\u6b62\u540d\u4e3a my_app \u7684\u5bb9\u5668\ndocker stop &#91;\u5bb9\u5668ID\u6216\u540d\u79f0]\n\n# \u91cd\u542f\u5bb9\u5668\ndocker restart &#91;\u5bb9\u5668ID\u6216\u540d\u79f0]<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">4. \u6545\u969c\u6392\u67e5<\/h2>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-c78ef679ab0db01fce651ce5cae39a79\"><code>\u5982\u679c\u4f60\u5728\u542f\u52a8\u65f6\u770b\u5230\u62a5\u9519\uff1aFailed to start docker.service: Unit is masked.\n\n<strong>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/strong>\n\u8fd0\u884c\u00a0sudo systemctl unmask docker docker.socket containerd\u00a0\u540e\u518d\u6b21\u5c1d\u8bd5\u542f\u52a8\u3002<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4f4e\u5185\u5b58\uff08\u59821\u68382G\uff09\u7684\u4e91\u670d\u52a1\u5668\u4e0a\uff0cDocker \u53ca\u5176\u5b88\u62a4\u8fdb\u7a0b\uff08dockerd\u3001containerd\uff09\u5373\u4f7f\u5728\u6ca1\u6709\u8fd0\u884c\u5bb9\u5668\u65f6\u4e5f\u4f1a\u5360\u7528 &#8230;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-107","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/tachyoncat.top\/index.php\/wp-json\/wp\/v2\/posts\/107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tachyoncat.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tachyoncat.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tachyoncat.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tachyoncat.top\/index.php\/wp-json\/wp\/v2\/comments?post=107"}],"version-history":[{"count":1,"href":"https:\/\/tachyoncat.top\/index.php\/wp-json\/wp\/v2\/posts\/107\/revisions"}],"predecessor-version":[{"id":108,"href":"https:\/\/tachyoncat.top\/index.php\/wp-json\/wp\/v2\/posts\/107\/revisions\/108"}],"wp:attachment":[{"href":"https:\/\/tachyoncat.top\/index.php\/wp-json\/wp\/v2\/media?parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tachyoncat.top\/index.php\/wp-json\/wp\/v2\/categories?post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tachyoncat.top\/index.php\/wp-json\/wp\/v2\/tags?post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}