{"id":8201,"date":"2022-05-06T17:54:58","date_gmt":"2022-05-06T09:54:58","guid":{"rendered":"https:\/\/blog.ywdevops.cn\/?p=8201"},"modified":"2023-07-22T18:53:42","modified_gmt":"2023-07-22T10:53:42","slug":"docker-10","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2022\/05\/06\/docker-10\/","title":{"rendered":"Docker\u5bb9\u5668\u91cd\u542f\u7b56\u7565"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u901a\u8fc7docker\u542f\u52a8\u5bb9\u5668\u540e\uff0c\u5982\u679c\u4e0d\u6307\u5b9a\u91cd\u542f\u7b56\u7565\uff0c\u4e00\u65e6\u5bb9\u5668\u5f02\u5e38\u60c5\u51b5\u4e0b\u9000\u51fa\uff0c\u6bd4\u5982\u673a\u5668\u53d1\u751f\u91cd\u542f\uff0c\u90a3\u4e48\u5bb9\u5668\u5c06\u4e0d\u4f1a\u91cd\u65b0\u88ab\u542f\u52a8\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">docker\u7684\u91cd\u542f\u7b56\u7565\u4e3b\u8981\u6709\u4e00\u4e0b\u51e0\u79cd\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>&#8211;restart=always\uff1a      \u8868\u793a\u5bb9\u5668\u9000\u51fa\u7684\u65f6\u5019\uff0cdocker\u603b\u4f1a\u91cd\u542f\u8fd9\u4e2a\u5bb9\u5668(\u6bd4\u5982\u673a\u5668\u53d1\u751f\u91cd\u542f\u540e)<\/li><li>&#8211;restart=on-failure:3 \u8868\u793a\u5bb9\u5668\u7684\u9000\u51fa\u72b6\u6001\u4e3a\u975e0(\u975e\u6b63\u5e38\u9000\u51fa)\uff0cdocker\u81ea\u52a8\u91cd\u542f\u6b64\u5bb9\u56683\u6b21\uff0c3\u6b21\u540e\u4e0d\u518d\u91cd\u542f<\/li><li>&#8211;restart=no                \u9ed8\u8ba4\u503c\uff0c\u8868\u793a\u5bb9\u5668\u9000\u51fa\u65f6\uff0cdocker\u4e0d\u81ea\u52a8\u91cd\u542f\u5bb9\u5668<\/li><li>&#8211;restart=unless-stopped  \u8868\u793a\u5bb9\u5668\u9000\u51fa\u65f6\u603b\u662f\u91cd\u542f\uff0c\u4f46\u662f\u4e0d\u8003\u8651docker\u5b88\u62a4\u8fdb\u7a0b\u8fd0\u884c\u7684\u65f6\u5019\u5df2\u7ecf\u505c\u6b62\u7684\u5bb9\u5668<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3e\u4f8b\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u547d\u4ee4\u8868\u793a\u521b\u5efa\u4e00\u4e2aNginx\u5bb9\u5668\uff0c\u5e76\u8bbe\u7f6e\u91cd\u542f\u7b56\u7565\u4e3aalways\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -d --name nginx  --restart=always  nginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u5728\u521b\u5efa\u5bb9\u5668\u7684\u65f6\u5019\u6ca1\u6709\u6307\u5b9a&#8211;restart\u53c2\u6570\uff0c\u53ef\u4ee5\u901a\u8fc7update\u6765\u66f4\u65b0\u5bb9\u5668<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker update   --restart=always   container-name \/\/\u5bb9\u5668\u9000\u51fa\u540e\u603b\u662f\u91cd\u542f\ndocker update   --restart=on-failure              \/\/\u5bb9\u5668\u4ee5\u975e0\u72b6\u6001\u9000\u51fa\u540e\u91cd\u542f\ndocker update   --restart=on-failure:3            \/\/\u5bb9\u5668\u4ee5\u975e0\u72b6\u6001\u9000\u51fa\u91cd\u542f3,3\u6b21\u540e\u653e\u5f03<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u901a\u8fc7docker\u542f\u52a8\u5bb9\u5668\u540e\uff0c\u5982\u679c\u4e0d\u6307\u5b9a\u91cd\u542f\u7b56\u7565\uff0c\u4e00\u65e6\u5bb9\u5668\u5f02\u5e38\u60c5\u51b5\u4e0b\u9000\u51fa\uff0c\u6bd4\u5982\u673a\u5668\u53d1\u751f\u91cd\u542f\uff0c\u90a3\u4e48\u5bb9\u5668\u5c06\u4e0d\u4f1a\u91cd\u65b0\u88ab [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":8206,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39,23],"tags":[],"class_list":["post-8201","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker","category-rong"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/8201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=8201"}],"version-history":[{"count":7,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/8201\/revisions"}],"predecessor-version":[{"id":13972,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/8201\/revisions\/13972"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/8206"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=8201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=8201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=8201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}