{"id":1492,"date":"2022-02-18T20:14:36","date_gmt":"2022-02-18T12:14:36","guid":{"rendered":"https:\/\/www.chenqing.work\/?p=1492"},"modified":"2023-05-15T15:45:30","modified_gmt":"2023-05-15T07:45:30","slug":"a-little-problem-%e4%bb%80%e4%b9%88%e6%98%af%e9%95%9c%e5%83%8f%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.chenqing.work\/?p=1492","title":{"rendered":"\u4e91\u539f\u751f\uff0cPart 0 | \u4ec0\u4e48\u662f Image \uff1f"},"content":{"rendered":"\n<p>\u5148\u6316\u5751\uff0c\u518d\u586b\u571f<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e91\u539f\u751f\uff0cPart 0\uff1a\u4ec0\u4e48\u662f Image \uff1f<\/li>\n\n\n\n<li>\u4e91\u539f\u751f\uff0cPart 1\uff1a\u4ec0\u4e48\u662f\u5bb9\u5668 \uff1f<\/li>\n\n\n\n<li><a href=\"https:\/\/www.chenqing.work\/?p=1655\" data-type=\"URL\" data-id=\"https:\/\/www.chenqing.work\/?p=1655\">\u4e91\u539f\u751f\uff0cPart 2\uff1a\u4ec0\u4e48\u662f Pod \uff1f<\/a><\/li>\n\n\n\n<li>\u4e91\u539f\u751f\uff0cPart 3\uff1a\u4ec0\u4e48\u662f Pod \u8c03\u5ea6 \uff1f<\/li>\n\n\n\n<li>&#8230;<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u5148\u4e0a\u7ed3\u8bba\uff1aImage = config.json\uff08\u914d\u7f6e\uff09 + rootfs\uff08\u6587\u4ef6\u7cfb\u7edf\uff09.<\/p>\n\n\n\n<p>\u63a5\u4e0b\u6765\u8ba9\u6211\u4eec\u4e00\u8d77\u62c6\u7bb1\u4e00\u4e2a Image \u3002<\/p>\n\n\n\n<p>\u5148\u4ece Dockerhub \u4e0a\u62c9\u4e00\u4e2a alpine \u4e0b\u6765\uff0calpine \u81ea\u5938\u5c0f\u4e2d\u738b\u8005\uff0c\u6211\u4eec\u9009\u4e2d\u7684\u8fd9\u4e2a\u955c\u50cf\u4ec5 5.59M\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ndocker pull alpine:3.15.0\n# \u6349\u51fa\u6765\u770b\u770b\ndocker save -o alpine.tar alpine:3.15.0\n<\/pre><\/div>\n\n\n<p>\u5b58\u5230\u672c\u5730\u540e\uff0c\u89e3\u5f00\u770b\u770b\u91cc\u9762\u90fd\u6709\u5565\uff0ctree \u4e00\u4e0b\u53ef\u4ee5\u53d1\u73b0\u91cc\u9762\u6709\u4e24\u5c42\u76ee\u5f55\uff0c\u51715\u4e2a\u6587\u4ef6\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1033\" height=\"261\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-11.png\" alt=\"\" class=\"wp-image-1554\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u7b2c\u4e00\u5c42\u76ee\u5f55\">\u7b2c\u4e00\u5c42\u76ee\u5f55<\/h2>\n\n\n\n<p>\u8fd9\u5c42\u76ee\u5f55\u67093\u4e2a\u6761\u76ee\uff1a<mark style=\"background-color:#078099\" class=\"has-inline-color has-white-color\">2\u4e2a json<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-white-color\"> <\/mark>+  <mark style=\"background-color:#078099\" class=\"has-inline-color has-white-color\">1\u4e2a\u4ee5 sha \u503c\u547d\u540d\u7684\u76ee\u5f55 &lt;25fe&#8230;&gt;<\/mark>\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1033\" height=\"261\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-10.png\" alt=\"\" class=\"wp-image-1553\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u2460-manifest-json\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ffa500\" class=\"has-inline-color\">\u2460 manifest.json<\/mark><\/h2>\n\n\n\n<p>\u6253\u5f00\u6e05\u5355\u6587\u4ef6 \uff0c\u91cc\u9762\u5217\u51fa\u4e86\u8fd9\u4e2a\u955c\u50cf\u7684\u6240\u6709\u5185\u5bb9\uff0c\u975e\u5e38\u7b80\u5355\uff0c\u5305\u62ec\uff1aConfig\uff08\u6307\u793a\u914d\u7f6e\u6587\u4ef6\uff09\u3001RepoTags\uff08\u5728\u955c\u50cf\u4ed3\u5e93\u91cc\u7684 tag\uff09\u3001Layers\uff08\u6240\u6709\u955c\u50cf\u5c42\u6587\u4ef6\uff09\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1070\" height=\"353\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-1.png\" alt=\"\" class=\"wp-image-1511\"\/><\/figure>\n\n\n\n<p>Config \u6307\u5411\u4e86\u540c\u4e00\u5c42\u7ea7\u7684\u53e6\u4e00\u4e2a json \u6587\u4ef6 &lt;c059&#8230;&gt;.json\u3002<\/p>\n\n\n\n<p>Layers \u5217\u51fa\u4e86\u6240\u6709\u7684\u955c\u50cf\u5c42\u6587\u4ef6\uff0c\u7b2c\u4e00\u4e2a\u4e3a\u7b2c\u4e00\u5c42\u955c\u50cf\u5c42\uff0c\u8fd9\u91cc\u6307\u5411\u4e86 &lt;25fe&#8230;&gt; \u76ee\u5f55\u4e0b\u7684 layer.tar \u6587\u4ef6\uff0c\u56e0\u4e3a\u6211\u4eec\u4e0b\u7684\u8fd9\u4e2a\u955c\u50cf\u6bd4\u8f83\u7b80\u5355\uff0c\u53ea\u6709\u4e00\u5c42\uff0c\u6240\u4ee5\u8fd9\u91cc\u53ea\u6709\u4e00\u6761 layer \u8bb0\u5f55\u3002\u5982\u679c\u6709\u591a\u6761 layer \u8bb0\u5f55\uff0c\u5c31\u4f1a\u4f9d\u6b21\u8ffd\u52a0\u5728\u540e\u9762\uff0c\u6bcf\u6761 layer \u8bb0\u5f55\u4e2d\u7684 sha \u503c\u90fd\u4f1a\u6709\u4e00\u4e2a\u5bf9\u5e94\u7684\u76ee\u5f55\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u2461-c059-json\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ffa500\" class=\"has-inline-color\">\u2461 &lt;c059&#8230;>.json<\/mark><\/h2>\n\n\n\n<p>\u8fd9\u4e2a json \u6587\u4ef6\u7684\u6587\u4ef6\u540d\u662f\u5b83\u81ea\u5df1\u7684 sha \u503c\uff0c\u4e5f\u662f\u6211\u4eec\u770b\u5230\u7684 Image ID\uff0c\u6587\u4ef6\u7684\u5185\u5bb9\u5c31\u662f\u955c\u50cf\u7684\u914d\u7f6e\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"851\" height=\"86\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-3.png\" alt=\"\" class=\"wp-image-1526\"\/><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u4fdd\u5b58\u4e86\u955c\u50cf\u7684\u914d\u7f6e\uff0c\u4e00\u76ee\u4e86\u7136\u7684\u5b57\u6bb5\u5c31\u4e0d\u8bf4\u4e86\u3002container_config\u3001container \u8fd9\u4e24\u9879\u8bb0\u5f55\u4e86\u6700\u540e commit \u5230\u955c\u50cf\u7684\u5bb9\u5668\u7684\u4fe1\u606f\u3002\u6211\u4eec\u77e5\u9053\uff0c\u955c\u50cf\u662f\u591a\u5c42\u53ea\u8bfb\u7684\u6587\u4ef6\u5c42\uff0c\u800c\u5bb9\u5668\u6307\u6700\u4e0a\u5c42\u7684\u53ef\u5199\u6587\u4ef6\u5c42\uff0c\u5c06\u5bb9\u5668 commit \u5230\u955c\u50cf\uff0c\u5c31\u662f\u628a\u53ef\u5199\u5c42\u63d0\u4ea4\u4e3a\u6700\u65b0\u7684\u4e00\u5c42\u53ea\u8bfb\u5c42\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1030\" height=\"323\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-2.png\" alt=\"\" class=\"wp-image-1513\"\/><\/figure>\n\n\n\n<p>config \u5217\u51fa\u4ece\u955c\u50cf\u542f\u52a8\u4e3a\u5bb9\u5668\u65f6\u7684\u9ed8\u8ba4\u914d\u7f6e\u53c2\u6570\uff0cEnv\u3001CMD\u3001Entrypoint \u8fd9\u4e9b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1072\" height=\"758\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-4.png\" alt=\"\" class=\"wp-image-1528\"\/><\/figure>\n\n\n\n<p>rootfs \u4e3b\u8981\u653e\u5404\u5c42\u6587\u4ef6\u7684\u6807\u8bc6\u2014\u2014diff_ids\uff0c\u672c\u5904\u7684 diff_id \u662f\u5bf9 &lt;25fe&#8230;&gt;\/ \u4e0b\u7684 layer.tar \u505a sha \u5f97\u5230\u7684\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"967\" height=\"174\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-5.png\" alt=\"\" class=\"wp-image-1530\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1155\" height=\"54\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-14.png\" alt=\"\" class=\"wp-image-1575\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u2462-25fe\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ffa500\" class=\"has-inline-color\">\u2462 25fe&#8230;\/<\/mark><\/h2>\n\n\n\n<p>\u8fd9\u662f\u6211\u4eec\u7684\u955c\u50cf\u6587\u4ef6\u5c42\uff0c\u76ee\u5f55\u540d\u79f0\u4e3a layer-chain-id\uff0c\u5728 OCI \u89c4\u8303\u4e2d layer-chain-id \u751f\u6210\u89c4\u5219\u5982\u4e0b\u56fe\u6240\u793a\u3002\u5b9e\u9645\u4e0a\u5728\u672c\u5730\u770b\u5230\u7684 layer-chain-id \u548c manifest.json \u91cc layers \u8bb0\u5f55\u7684\u503c\u5e76\u4e0d\u76f8\u540c\uff0c\u53ef\u80fd\u8ba1\u7b97\u7684\u662f registry \u91cc\u5b58\u50a8\u7684\u538b\u7f29\u6587\u4ef6\u7684 sha\uff0c\u800c\u975e\u672c\u5730\u62c9\u4e0b\u6765\u8fd9\u4e2a\u2014\u2014\u8fd9\u4e2a\u955c\u50cf\u6709\u70b9\u4e0d\u8bb2\u7a76\u3002\u62c9\u4e2a nginx \u955c\u50cf\u53ef\u4ee5\u770b\u5230 diff-id\u3001layer-chain-id \u662f\u9075\u5faa  OCI \u7684 Image Format \u89c4\u8303\u7684\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1330\" height=\"122\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-17.png\" alt=\"\" class=\"wp-image-1588\"\/><\/figure>\n\n\n\n<p>\u6253\u5f00\u770b\u770b\u7b2c\u4e8c\u5c42\u76ee\u5f55\u90fd\u6709\u5565\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u7b2c\u4e8c\u5c42\u76ee\u5f55\">\u7b2c\u4e8c\u5c42\u76ee\u5f55<\/h2>\n\n\n\n<p>\u63a5\u4e0b\u6765\u8fdb\u5165 &lt;25fe&#8230;&gt; \u76ee\u5f55\u4e2d\uff0c\u6709\u4e09\u4e2a\u6587\u4ef6\uff1ajson\u3001VERSION\u3001layer.tar\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1043\" height=\"148\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-13.png\" alt=\"\" class=\"wp-image-1564\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u2463-json\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ffa500\" class=\"has-inline-color\">\u2463 json<\/mark><\/h2>\n\n\n\n<p>\u8fd9\u662f\u672c\u5c42\u955c\u50cf\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u548c\u6211\u4eec\u5728\u7b2c\u4e00\u7ea7\u76ee\u5f55\u770b\u5230\u7684 &lt;c059&#8230;&gt;.json \u5dee\u4e0d\u591a\uff0c\u90fd\u662f\u914d\u7f6e\u53c2\u6570\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1120\" height=\"530\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-15.png\" alt=\"\" class=\"wp-image-1578\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u2464-layer-tar\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ffa500\" class=\"has-inline-color\">\u2464 layer.tar<\/mark><\/h2>\n\n\n\n<p>\u89e3\u5f00 layer.tar \u53ef\u4ee5\u53d1\u73b0\u8fd9\u5c31\u662f\u6211\u4eec\u6302\u5728\u5634\u8fb9\u7684\uff08\u5e94\u7528\u8fd0\u884c\u6240\u4f9d\u8d56\u7684\uff09\u64cd\u4f5c\u7cfb\u7edf\u73af\u5883\u3002\u5982\u679c\u6709\u4e0d\u6b62\u4e00\u5c42\uff0c\u5219\u9664\u4e86\u7b2c\u4e00\u5c42\u7684\u540e\u7eed\u5c42\u4e00\u822c\u5c31\u653e\u589e\u91cf\u7684\u6587\u4ef6\uff0c\u5bf9\u4e8e\u540c\u6837\u7684\u6587\u4ef6\uff0cn+1 \u5c42\u4f1a\u8986\u76d6\u524d\u9762 n \u5c42\u4e2d\u51fa\u73b0\u7684\u540c\u540d\u6587\u4ef6\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1095\" height=\"495\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-7.png\" alt=\"\" class=\"wp-image-1535\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u2465-version\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ffa500\" class=\"has-inline-color\">\u2465 VERSION<\/mark><\/h2>\n\n\n\n<p>\u4fdd\u5b58\u4e86\u4e00\u4e2a\u7248\u672c\u53f7\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"244\" height=\"40\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/02\/image-16.png\" alt=\"\" class=\"wp-image-1580\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u6700\u540e\">\u6700\u540e<\/h2>\n\n\n\n<p>\u518d\u56de\u5230 manifest.json\uff0c1\u4e2a Config + 1\u4e2a layer.tar \u2248 alpine image\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e00\u4e2a\u5178\u578b\u7684\u955c\u50cf\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u66f4\u591a\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/opencontainers\/image-spec\/blob\/main\/config.md\">https:\/\/github.com\/opencontainers\/image-spec\/blob\/main\/config.md<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/programmer.group\/docker-learning-image-s-local-storage-architecture.html\">https:\/\/programmer.group\/docker-learning-image-s-local-storage-architecture.html<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/stackoverflow.com\/questions\/36216220\/what-is-different-of-config-and-containerconfig-of-docker-inspect\">https:\/\/stackoverflow.com\/questions\/36216220\/what-is-different-of-config-and-containerconfig-of-docker-inspect<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/opensource.com\/article\/18\/8\/sysadmins-guide-containers\">https:\/\/opensource.com\/article\/18\/8\/sysadmins-guide-containers<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u6316\u5751\uff0c\u518d\u586b\u571f \u5148\u4e0a\u7ed3\u8bba\uff1aImage = config.json\uff08\u914d\u7f6e\uff09 + rootfs\uff08\u6587\u4ef6\u7cfb\u7edf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[61,60],"class_list":["post-1492","post","type-post","status-publish","format-standard","hentry","category-code","tag-image","tag-60"],"_links":{"self":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/1492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1492"}],"version-history":[{"count":123,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/1492\/revisions"}],"predecessor-version":[{"id":8892,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/1492\/revisions\/8892"}],"wp:attachment":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}