{"id":258,"date":"2024-09-05T10:38:36","date_gmt":"2024-09-05T02:38:36","guid":{"rendered":"http:\/\/znl.pub\/?p=258"},"modified":"2024-09-05T10:43:43","modified_gmt":"2024-09-05T02:43:43","slug":"%e5%9c%a8-dockerfile-%e4%b8%ad%e4%bb%a5-scratch-%e4%b8%ba%e5%9f%ba%e7%a1%80%e9%95%9c%e5%83%8f-from-scratch","status":"publish","type":"post","link":"https:\/\/znl.pub\/?p=258","title":{"rendered":"\u5728 Dockerfile \u4e2d\u4ee5 scratch \u4e3a\u57fa\u7840\u955c\u50cf (FROM scratch)"},"content":{"rendered":"\n<p>\u901a\u5e38\u4f7f\u7528 Docker \u955c\u50cf\u65f6\u4f1a\u4ee5\u4e00\u4e2a\u5df2\u5b58\u5728\u7684\u955c\u50cf\u4e3a\u57fa\u7840\uff0c\u5728\u5176\u4e0a\u8fdb\u884c\u5b9a\u5236\uff0c\u8fd9\u4e2a\u5df2\u5b58\u5728\u7684\u955c\u50cf\u5c31\u662f\u57fa\u7840\u955c\u50cf\u3002<\/p>\n\n\n\n<p>\u5728 DockerFile \u4e2d\u5fc5\u987b\u6307\u5b9a\u57fa\u7840\u955c\u50cf\uff0cFROM \u6307\u4ee4\u5c31\u662f\u7528\u4e8e\u6307\u5b9a\u57fa\u7840\u955c\u50cf\uff0c\u56e0\u6b64\u4e00\u4e2a Dockerfile \u4e2d FROM \u662f\u5fc5\u5907\u7684\u6307\u4ee4\uff0c\u5e76\u4e14\u5fc5\u987b\u662f\u7b2c\u4e00\u6761\u6307\u4ee4\u3002<\/p>\n\n\n\n<p>Docker \u8fd8\u5b58\u5728\u4e00\u4e2a\u7279\u6b8a\u7684\u955c\u50cf\uff0c\u540d\u4e3a<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"> scratch<\/mark>\u3002\u8fd9\u4e2a\u955c\u50cf\u662f\u865a\u62df\u7684\u6982\u5ff5\uff0c\u5e76\u4e0d\u5b9e\u9645\u5b58\u5728\uff0c\u5b83<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u8868\u793a<\/mark>\u4e00\u4e2a<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u7a7a\u767d<\/mark>\u7684<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u955c\u50cf<\/mark>\u3002\u5728 Dockerfile \u4e2d\u4ee5 scratch \u4e3a\u57fa\u7840\u955c\u50cf (FROM scratch)\uff0c<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u610f\u5473\u7740\u4e0d\u4ee5\u4efb\u4f55\u955c\u50cf\u4e3a\u57fa\u7840<\/mark>\uff0c\u63a5\u4e0b\u6765\u6240\u5199\u7684\u6307\u4ee4\u5c06\u4f5c\u4e3a\u955c\u50cf\u7b2c\u4e00\u5c42\u5f00\u59cb\u5b58\u5728\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8e Linux \u4e0b\u9759\u6001\u7f16\u8bd1\u7684\u7a0b\u5e8f\u6765\u8bf4\uff0c\u5e76\u4e0d\u9700\u8981\u6709\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u8fd0\u884c\u65f6\u652f\u6301\uff0c\u6240\u9700\u7684\u4e00\u5207\u5e93\u90fd\u5df2\u7ecf\u5728\u53ef\u6267\u884c\u6587\u4ef6\u91cc\u4e86\uff0c\u56e0\u6b64\u76f4\u63a5 FROM scratch \u4f1a\u8ba9\u955c\u50cf\u4f53\u79ef\u66f4\u52a0\u5c0f\u5de7\u3002\u4f7f\u7528 Go \u8bed\u8a00\u5f00\u53d1\u7684\u5e94\u7528\u5f88\u591a\u4f1a\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u6765\u5236\u4f5c\u955c\u50cf\uff0c\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u6709\u4eba\u8ba4\u4e3a Go \u662f\u7279\u522b\u9002\u5408\u5bb9\u5668\u5fae\u670d\u52a1\u67b6\u6784\u7684\u8bed\u8a00\u7684\u539f\u56e0\u4e4b\u4e00\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><a href=\"https:\/\/www.cnblogs.com\/tkuang\/p\/17219527.html\">https:\/\/www.cnblogs.com\/tkuang\/p\/17219527.html<\/a><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u901a\u5e38\u4f7f\u7528 Docker \u955c\u50cf\u65f6\u4f1a\u4ee5\u4e00\u4e2a\u5df2\u5b58\u5728\u7684\u955c\u50cf\u4e3a\u57fa\u7840\uff0c\u5728\u5176\u4e0a\u8fdb\u884c\u5b9a\u5236\uff0c\u8fd9\u4e2a\u5df2\u5b58\u5728\u7684\u955c\u50cf\u5c31\u662f\u57fa\u7840\u955c\u50cf\u3002 \u5728 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,19,10],"tags":[],"class_list":{"0":"post-258","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-docker","8":"category-linux"},"_links":{"self":[{"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/posts\/258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/znl.pub\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=258"}],"version-history":[{"count":4,"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/posts\/258\/revisions"}],"predecessor-version":[{"id":264,"href":"https:\/\/znl.pub\/index.php?rest_route=\/wp\/v2\/posts\/258\/revisions\/264"}],"wp:attachment":[{"href":"https:\/\/znl.pub\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/znl.pub\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/znl.pub\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}