{"id":4172,"date":"2024-11-11T11:57:34","date_gmt":"2024-11-11T03:57:34","guid":{"rendered":"https:\/\/fwq.ai\/blog\/4172\/"},"modified":"2024-11-11T11:57:34","modified_gmt":"2024-11-11T03:57:34","slug":"%e6%a0%87%e6%b3%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/4172\/","title":{"rendered":"\u6807\u6ce8"},"content":{"rendered":"<h1>\u6807\u6ce8<\/h1>\n<p>\u6211\u4eec\u652f\u6301\u4ee5\u4e0b\u51e0\u7c7b\u6807\u6ce8\uff1a<\/p>\n<ul>\n<li>\u7248\u672c\u6807\u6ce8<\/li>\n<li>\u6ce8\u91ca\uff08\u4e0d\u9700\u8981 HTML \u5c5e\u6027\uff09<\/li>\n<li>\u4f7f\u7528\u7c7b\u7684<code>{ .tip }<\/code>\u63d0\u793a<\/li>\n<li>\u91cd\u8981\u7684\u662f\uff0c\u5176\u4e2d\u4f7f\u7528\u4e86<code>{ .important }<\/code>\u7c7b<\/li>\n<li>\u8b66\u544a\uff0c\u4f7f\u7528<code>{ .warning }<\/code>\u8be5\u7c7b<\/li>\n<li>\u5b9e\u9a8c\u6027\u7684\uff0c\u4f7f\u7528<code>{ .experimental }<\/code>\u7c7b<\/li>\n<li>\u53d7\u9650\u5236\uff0c\u4f7f\u7528<code>{ .restricted }<\/code>\u8be5\u7c7b<\/li>\n<\/ul>\n<h2><\/h2>\n<p><span> <\/span><br \/>\n<span>\u4e2d\u5f15\u5165 <\/span> <\/p>\n<blockquote>\n<p><strong>\u7b14\u8bb0<\/strong><\/p>\n<p><code>get_hit_count<\/code>\u8bf7\u6ce8\u610f\u8be5\u51fd\u6570\u7684\u7f16\u5199\u65b9\u5f0f\u3002\u5982\u679c redis \u670d\u52a1\u4e0d\u53ef\u7528\uff0c\u8fd9\u4e2a\u57fa\u672c\u7684\u91cd\u8bd5\u5faa\u73af\u5141\u8bb8\u6211\u4eec\u591a\u6b21\u5c1d\u8bd5\u6211\u4eec\u7684\u8bf7\u6c42\u3002\u8fd9\u5728\u5e94\u7528\u7a0b\u5e8f\u4e0a\u7ebf\u65f6\u542f\u52a8\u65f6\u5f88\u6709\u7528\uff0c\u800c\u4e14\u5982\u679c Redis \u670d\u52a1\u9700\u8981\u5728\u5e94\u7528\u7a0b\u5e8f\u7684\u751f\u547d\u5468\u671f\u5185\u968f\u65f6\u91cd\u65b0\u542f\u52a8\uff0c\u8fd9\u4e5f\u4f7f\u6211\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u66f4\u5177\u5f39\u6027\u3002\u5728\u96c6\u7fa4\u4e2d\uff0c\u8fd9\u8fd8\u6709\u52a9\u4e8e\u5904\u7406\u8282\u70b9\u4e4b\u95f4\u7684\u77ac\u65f6\u8fde\u63a5\u4e22\u5931\u3002<\/p>\n<\/blockquote>\n<blockquote>\n<p><strong>\u63d0\u793a<\/strong><\/p>\n<p>\u5bf9\u4e8e\u8f83\u5c0f\u7684\u57fa\u7840\u6620\u50cf\uff0c\u8bf7\u4f7f\u7528<code>alpine<\/code>.<\/p>\n<\/blockquote>\n<blockquote>\n<p><strong>\u91cd\u8981\u7684<\/strong><\/p>\n<p>\u50cf\u5bf9\u5f85\u5bc6\u7801\u4e00\u6837\u5bf9\u5f85\u8bbf\u95ee\u4ee4\u724c\u5e76\u4fdd\u5bc6\u3002\u5b89\u5168\u5730\u5b58\u50a8\u60a8\u7684\u4ee4\u724c\uff08\u4f8b\u5982\uff0c\u5728\u51ed\u8bc1\u7ba1\u7406\u5668\u4e2d\uff09\u3002<\/p>\n<\/blockquote>\n<blockquote>\n<p><strong>\u8b66\u544a<\/strong><\/p>\n<p>\u5220\u9664\u5377<\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u8fd0\u884c\u65f6\u4e0d\u4f1a\u5220\u9664 compose \u6587\u4ef6\u4e2d\u7684\u547d\u540d\u5377 <code>docker compose down<\/code>\u3002\u5982\u679c\u8981\u5220\u9664\u5377\uff0c\u5219\u9700\u8981\u6dfb\u52a0\u8be5<code>--volumes<\/code>\u6807\u5fd7\u3002<\/p>\n<p>\u5f53\u60a8\u5220\u9664\u5e94\u7528\u7a0b\u5e8f\u5806\u6808\u65f6\uff0cDocker \u4eea\u8868\u677f\u4e0d\u4f1a\u5220\u9664\u5377\u3002<\/p>\n<\/blockquote>\n<p>\u5bf9\u4e8e\u4ee5\u4e0b\u4e24\u4e2a\u6807\u6ce8\uff0c\u8bf7\u53c2\u9605 \u4ee5\u83b7\u53d6\u6709\u5173\u4f55\u65f6\u4f7f\u7528\u5b83\u4eec\u7684\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n<blockquote>\n<p><strong>\u6d4b\u8bd5\u7248\u529f\u80fd<\/strong><\/p>\n<p>\u6784\u5efa\u89c6\u56fe\u76ee\u524d\u5904\u4e8e\u6d4b\u8bd5\u9636\u6bb5\u3002\u6b64\u529f\u80fd\u53ef\u80fd\u4f1a\u66f4\u6539\u6216\u4ece\u672a\u6765\u7248\u672c\u4e2d\u5220\u9664\u3002<\/p>\n<\/blockquote>\n<blockquote>\n<p><strong>\u53d7\u9650\u5236\u7684<\/strong><\/p>\n<p>Docker Scout \u662f\u4e00\u4e2a  \u4ea7\u54c1\u3002<\/p>\n<\/blockquote>\n<h2><\/h2>\n<p><span> <\/span><br \/>\n<span> <\/span> <\/p>\n<pre><code><span><span><span>{{&lt;<\/span> <span>introduced<\/span> <span>buildx<\/span> <span>0.10.4<\/span> <span>\"..\/..\/release-notes.md#0104\"<\/span> <span>&gt;}}<\/span><\/span><\/span><\/code><\/pre>\n<p><span> <\/span><br \/>\n<span> <\/span> <\/p>\n<pre><code><span><span>&gt; **Note** <\/span><\/span><span><span>&gt; <\/span><\/span><span><span>&gt; Note the way the `get_hit_count` function is written. This basic retry <\/span><\/span><span><span>&gt; loop lets us attempt our request multiple times if the redis service is <\/span><\/span><span><span>&gt; not available. This is useful at startup while the application comes <\/span><\/span><span><span>&gt; online, but also makes our application more resilient if the Redis <\/span><\/span><span><span>&gt; service needs to be restarted anytime during the app's lifetime. In a <\/span><\/span><span><span>&gt; cluster, this also helps handling momentary connection drops between <\/span><\/span><span><span>&gt; nodes. <\/span><\/span><span><span> <\/span><\/span><span><span>&gt; **Tip** <\/span><\/span><span><span>&gt; <\/span><\/span><span><span>&gt; For a smaller base image, use `alpine`. <\/span><\/span><span><span>{ .tip } <\/span><\/span><span><span> <\/span><\/span><span><span>&gt; **Important** <\/span><\/span><span><span>&gt; <\/span><\/span><span><span>&gt; Treat access tokens like your password and keep them secret. Store your <\/span><\/span><span><span>&gt; tokens securely (for example, in a credential manager). <\/span><\/span><span><span>{ .important } <\/span><\/span><span><span> <\/span><\/span><span><span>&gt; **Warning** <\/span><\/span><span><span>&gt; <\/span><\/span><span><span>&gt; Removing Volumes <\/span><\/span><span><span>&gt; <\/span><\/span><span><span>&gt; By default, named volumes in your compose file are NOT removed when running <\/span><\/span><span><span>&gt; `docker compose down`. If you want to remove the volumes, you will need to add <\/span><\/span><span><span>&gt; the `--volumes` flag. <\/span><\/span><span><span>&gt; <\/span><\/span><span><span>&gt; The Docker Dashboard does _not_ remove volumes when you delete the app stack. <\/span><\/span><span><span>{ .warning } <\/span><\/span><span><span> <\/span><\/span><span><span>&gt; **Beta feature** <\/span><\/span><span><span>&gt; <\/span><\/span><span><span>&gt; The Builds view is currently in Beta. This feature may change or be removed from future releases. <\/span><\/span><span><span>{ .experimental } <\/span><\/span><span><span> <\/span><\/span><span><span>&gt; **Restricted** <\/span><\/span><span><span>&gt; <\/span><\/span><span><span>&gt; Docker Scout is an [early access](\/release-lifecycle\/#early-access-ea) <\/span><\/span><span><span>&gt; product. <\/span><\/span><span><span>{ .restricted }<\/span><\/span><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6807\u6ce8 \u6211\u4eec\u652f\u6301\u4ee5\u4e0b\u51e0\u7c7b\u6807\u6ce8\uff1a \u7248\u672c\u6807\u6ce8 \u6ce8\u91ca\uff08\u4e0d\u9700\u8981 HTML \u5c5e\u6027\uff09 \u4f7f\u7528\u7c7b\u7684{ .tip }\u63d0\u793a \u91cd\u8981\u7684\u662f\uff0c\u5176\u4e2d\u4f7f\u7528\u4e86{ .important }\u7c7b \u8b66\u544a\uff0c\u4f7f\u7528{ .warning }\u8be5\u7c7b \u5b9e\u9a8c\u6027\u7684\uff0c\u4f7f\u7528{ .experimental }\u7c7b \u53d7\u9650\u5236\uff0c\u4f7f\u7528{ .restricted }\u8be5\u7c7b \u4e2d\u5f15\u5165 \u7b14\u8bb0 get_hit_count\u8bf7\u6ce8\u610f\u8be5\u51fd\u6570\u7684\u7f16\u5199\u65b9\u5f0f\u3002\u5982\u679c redis \u670d\u52a1\u4e0d\u53ef\u7528\uff0c\u8fd9\u4e2a\u57fa\u672c\u7684\u91cd\u8bd5\u5faa\u73af\u5141\u8bb8\u6211\u4eec\u591a\u6b21\u5c1d\u8bd5\u6211\u4eec\u7684\u8bf7\u6c42\u3002\u8fd9\u5728\u5e94\u7528\u7a0b\u5e8f\u4e0a\u7ebf\u65f6\u542f\u52a8\u65f6\u5f88\u6709\u7528\uff0c\u800c\u4e14\u5982\u679c Redis \u670d\u52a1\u9700\u8981\u5728\u5e94\u7528\u7a0b\u5e8f\u7684\u751f\u547d\u5468\u671f\u5185\u968f\u65f6\u91cd\u65b0\u542f\u52a8\uff0c\u8fd9\u4e5f\u4f7f\u6211\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u66f4\u5177\u5f39\u6027\u3002\u5728\u96c6\u7fa4\u4e2d\uff0c\u8fd9\u8fd8\u6709\u52a9\u4e8e\u5904\u7406\u8282\u70b9\u4e4b\u95f4\u7684\u77ac\u65f6\u8fde\u63a5\u4e22\u5931\u3002 \u63d0\u793a \u5bf9\u4e8e\u8f83\u5c0f\u7684\u57fa\u7840\u6620\u50cf\uff0c\u8bf7\u4f7f\u7528alpine. \u91cd\u8981\u7684 \u50cf\u5bf9\u5f85\u5bc6\u7801\u4e00\u6837\u5bf9\u5f85\u8bbf\u95ee\u4ee4\u724c\u5e76\u4fdd\u5bc6\u3002\u5b89\u5168\u5730\u5b58\u50a8\u60a8\u7684\u4ee4\u724c\uff08\u4f8b\u5982\uff0c\u5728\u51ed\u8bc1\u7ba1\u7406\u5668\u4e2d\uff09\u3002 \u8b66\u544a \u5220\u9664\u5377 \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u8fd0\u884c\u65f6\u4e0d\u4f1a\u5220\u9664 compose \u6587\u4ef6\u4e2d\u7684\u547d\u540d\u5377 docker compose down\u3002\u5982\u679c\u8981\u5220\u9664\u5377\uff0c\u5219\u9700\u8981\u6dfb\u52a0\u8be5&#8211;volumes\u6807\u5fd7\u3002 \u5f53\u60a8\u5220\u9664\u5e94\u7528\u7a0b\u5e8f\u5806\u6808\u65f6\uff0cDocker \u4eea\u8868\u677f\u4e0d\u4f1a\u5220\u9664\u5377\u3002 \u5bf9\u4e8e\u4ee5\u4e0b\u4e24\u4e2a\u6807\u6ce8\uff0c\u8bf7\u53c2\u9605 \u4ee5\u83b7\u53d6\u6709\u5173\u4f55\u65f6\u4f7f\u7528\u5b83\u4eec\u7684\u66f4\u591a\u4fe1\u606f\u3002 \u6d4b\u8bd5\u7248\u529f\u80fd \u6784\u5efa\u89c6\u56fe\u76ee\u524d\u5904\u4e8e\u6d4b\u8bd5\u9636\u6bb5\u3002\u6b64\u529f\u80fd\u53ef\u80fd\u4f1a\u66f4\u6539\u6216\u4ece\u672a\u6765\u7248\u672c\u4e2d\u5220\u9664\u3002 \u53d7\u9650\u5236\u7684 Docker Scout \u662f\u4e00\u4e2a \u4ea7\u54c1\u3002 {{&lt; introduced buildx 0.10.4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-4172","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/4172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=4172"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/4172\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=4172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=4172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=4172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}