{"id":18302,"date":"2024-11-18T13:47:30","date_gmt":"2024-11-18T05:47:30","guid":{"rendered":"https:\/\/fwq.ai\/blog\/18302\/"},"modified":"2024-11-18T13:47:30","modified_gmt":"2024-11-18T05:47:30","slug":"docker%e6%8b%89%e5%8f%96%e9%95%9c%e5%83%8f%e6%80%8e%e4%b9%88%e8%ae%be%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/18302\/","title":{"rendered":"docker\u62c9\u53d6\u955c\u50cf\u600e\u4e48\u8bbe\u7f6e"},"content":{"rendered":"<blockquote><p>\n  docker \u62c9\u53d6\u955c\u50cf\u65f6\u53ef\u81ea\u5b9a\u4e49\u8bbe\u7f6e\uff0c\u5305\u62ec\uff1a\u6307\u5b9a\u955c\u50cf\u7248\u672c\u3001\u955c\u50cf\u4ed3\u5e93\u3001\u9650\u901f\u62c9\u53d6\u3001\u8eab\u4efd\u9a8c\u8bc1\u548c\u62c9\u53d6\u65e0\u6807\u7b7e\u955c\u50cf\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u901a\u8fc7 docker pull \u547d\u4ee4\u53ca\u5176\u9009\u9879\u5b9e\u73b0\uff0c\u5305\u62ec &#8211;registry\u3001&#8211;limit-rate\u3001&#8211;auth \u548c -a\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/05\/2024060509241981799.jpg\" class=\"aligncenter\" title=\"docker\u62c9\u53d6\u955c\u50cf\u600e\u4e48\u8bbe\u7f6e\u63d2\u56fe\" alt=\"docker\u62c9\u53d6\u955c\u50cf\u600e\u4e48\u8bbe\u7f6e\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u8bbe\u7f6e Docker \u62c9\u53d6\u955c\u50cf<\/strong><\/p>\n<p><strong>\u7b80\u4ecb<\/strong><br \/>Docker \u62c9\u53d6\u955c\u50cf\u7528\u4e8e\u4ece Docker \u955c\u50cf\u4ed3\u5e93\u4e2d\u83b7\u53d6\u6240\u9700\u955c\u50cf\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528  pull \u547d\u4ee4\u62c9\u53d6\u955c\u50cf\uff0c\u4f46\u6709\u65f6\u9700\u8981\u8fdb\u884c\u5176\u4ed6\u8bbe\u7f6e\u4ee5\u63a7\u5236\u62c9\u53d6\u884c\u4e3a\u3002<\/p>\n<p><strong>\u8bbe\u7f6e<\/strong><br \/>\u4ee5\u4e0b\u662f\u4e00\u4e9b Docker \u62c9\u53d6\u955c\u50cf\u65f6\u53ef\u7528\u7684\u8bbe\u7f6e\uff1a<\/p>\n<p><strong>1. \u6307\u5b9a\u955c\u50cf\u7248\u672c<\/strong><\/p>\n<pre>docker pull &lt;image-name&gt;:&lt;tag&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d \u6307\u5b9a\u955c\u50cf\u7684\u7248\u672c\u6216\u6807\u7b7e\u3002\u4f8b\u5982\uff0c\u8981\u62c9\u53d6 Ubuntu \u955c\u50cf\u7684\u6700\u65b0\u7248\u672c\uff0c\u8bf7\u4f7f\u7528\uff1a <\/p>\n<pre>docker pull ubuntu:latest<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u6307\u5b9a\u955c\u50cf\u4ed3\u5e93<\/strong><br \/>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cDocker \u4f1a\u4ece Docker Hub\uff08\u5b98\u65b9\u955c\u50cf\u4ed3\u5e93\uff09\u62c9\u53d6\u955c\u50cf\u3002\u8981\u4ece\u5176\u4ed6\u955c\u50cf\u4ed3\u5e93\u62c9\u53d6\u955c\u50cf\uff0c\u8bf7\u4f7f\u7528 &#8211;registry \u9009\u9879\uff1a<\/p>\n<pre>docker pull --registry &lt;registry-url&gt; &lt;image-name&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u4ece Google \u5bb9\u5668\u955c\u50cf\u4ed3\u5e93\u62c9\u53d6\u955c\u50cf\uff0c\u8bf7\u4f7f\u7528\uff1a<\/p>\n<pre>docker pull --registry https:\/\/gcr.io google\/debian:latest<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u9650\u901f\u62c9\u53d6<\/strong><br \/>\u4f7f\u7528 &#8211;limit-rate \u9009\u9879\u53ef\u4ee5\u9650\u5236\u62c9\u53d6\u901f\u5ea6\uff1a<\/p>\n<pre>docker pull --limit-rate &lt;bytes-per-second&gt; &lt;image-name&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u5c06\u62c9\u53d6\u901f\u5ea6\u9650\u5236\u4e3a\u6bcf\u79d2 1 MB\uff1a<\/p>\n<pre>docker pull --limit-rate 1mb &lt;image-name&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u8eab\u4efd\u9a8c\u8bc1<\/strong><br \/>\u67d0\u4e9b\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\u9700\u8981\u8eab\u4efd\u9a8c\u8bc1\u624d\u80fd\u8bbf\u95ee\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 &#8211;auth \u9009\u9879\u63d0\u4f9b\u51ed\u8bc1\uff1a<\/p>\n<pre>docker pull --auth &lt;username&gt;:&lt;password&gt; &lt;image-name&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u62c9\u53d6\u79c1\u6709\u955c\u50cf\uff0c\u8bf7\u4f7f\u7528\uff1a<\/p>\n<pre>docker pull --auth myusername:mypassword myregistry.io\/myimage<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u65e0\u6807\u7b7e\u955c\u50cf<\/strong><br \/>\u5982\u679c\u955c\u50cf\u6ca1\u6709\u6807\u7b7e\uff0c\u53ef\u4ee5\u4f7f\u7528 -a \u9009\u9879\u62c9\u53d6\u5b83\uff1a<\/p>\n<pre>docker pull -a &lt;image-name&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u62c9\u53d6\u540d\u4e3a &#8220;myimage&#8221; \u7684\u65e0\u6807\u7b7e\u955c\u50cf\uff0c\u8bf7\u4f7f\u7528\uff1a<\/p>\n<pre>docker pull -a myimage<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5176\u4ed6\u6ce8\u610f\u4e8b\u9879<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd\u60a8\u62e5\u6709\u62c9\u53d6\u955c\u50cf\u6240\u9700\u7684\u6743\u9650\u3002<\/li>\n<li>Docker \u4f1a\u81ea\u52a8\u5c06\u62c9\u53d6\u7684\u955c\u50cf\u5b58\u50a8\u5728\u4e3b\u673a\u4e0a\u7684\u672c\u5730\u955c\u50cf\u4ed3\u5e93\u4e2d\u3002<\/li>\n<li>\u60a8\u53ef\u4ee5\u4f7f\u7528 docker images \u547d\u4ee4\u67e5\u770b\u672c\u5730\u5b58\u50a8\u7684\u955c\u50cf\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u62c9\u53d6\u955c\u50cf\u600e\u4e48\u8bbe\u7f6e\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>docker \u62c9\u53d6\u955c\u50cf\u65f6\u53ef\u81ea\u5b9a\u4e49\u8bbe\u7f6e\uff0c\u5305\u62ec\uff1a\u6307\u5b9a\u955c\u50cf\u7248\u672c\u3001\u955c\u50cf\u4ed3\u5e93\u3001\u9650\u901f\u62c9\u53d6\u3001\u8eab\u4efd\u9a8c\u8bc1\u548c\u62c9\u53d6\u65e0\u6807\u7b7e\u955c\u50cf\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u901a\u8fc7 docker pull \u547d\u4ee4\u53ca\u5176\u9009\u9879\u5b9e\u73b0\uff0c\u5305\u62ec &#8211;registry\u3001&#8211;limit-rate\u3001&#8211;auth \u548c -a\u3002 \u5982\u4f55\u8bbe\u7f6e Docker \u62c9\u53d6\u955c\u50cf \u7b80\u4ecbDocker \u62c9\u53d6\u955c\u50cf\u7528\u4e8e\u4ece Docker \u955c\u50cf\u4ed3\u5e93\u4e2d\u83b7\u53d6\u6240\u9700\u955c\u50cf\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 pull \u547d\u4ee4\u62c9\u53d6\u955c\u50cf\uff0c\u4f46\u6709\u65f6\u9700\u8981\u8fdb\u884c\u5176\u4ed6\u8bbe\u7f6e\u4ee5\u63a7\u5236\u62c9\u53d6\u884c\u4e3a\u3002 \u8bbe\u7f6e\u4ee5\u4e0b\u662f\u4e00\u4e9b Docker \u62c9\u53d6\u955c\u50cf\u65f6\u53ef\u7528\u7684\u8bbe\u7f6e\uff1a 1. \u6307\u5b9a\u955c\u50cf\u7248\u672c docker pull &lt;image-name&gt;:&lt;tag&gt; \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d \u6307\u5b9a\u955c\u50cf\u7684\u7248\u672c\u6216\u6807\u7b7e\u3002\u4f8b\u5982\uff0c\u8981\u62c9\u53d6 Ubuntu \u955c\u50cf\u7684\u6700\u65b0\u7248\u672c\uff0c\u8bf7\u4f7f\u7528\uff1a docker pull ubuntu:latest \u767b\u5f55\u540e\u590d\u5236 2. \u6307\u5b9a\u955c\u50cf\u4ed3\u5e93\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cDocker \u4f1a\u4ece Docker Hub\uff08\u5b98\u65b9\u955c\u50cf\u4ed3\u5e93\uff09\u62c9\u53d6\u955c\u50cf\u3002\u8981\u4ece\u5176\u4ed6\u955c\u50cf\u4ed3\u5e93\u62c9\u53d6\u955c\u50cf\uff0c\u8bf7\u4f7f\u7528 &#8211;registry \u9009\u9879\uff1a docker pull &#8211;registry &lt;registry-url&gt; &lt;image-name&gt; \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff0c\u8981\u4ece Google \u5bb9\u5668\u955c\u50cf\u4ed3\u5e93\u62c9\u53d6\u955c\u50cf\uff0c\u8bf7\u4f7f\u7528\uff1a docker pull &#8211;registry https:\/\/gcr.io google\/debian:latest [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-18302","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18302","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=18302"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18302\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=18302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=18302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=18302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}