{"id":415,"date":"2021-09-09T07:51:00","date_gmt":"2021-09-09T07:51:00","guid":{"rendered":"https:\/\/262235.xyz\/?p=415"},"modified":"2021-09-09T07:51:00","modified_gmt":"2021-09-09T07:51:00","slug":"415","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2021\/09\/09\/415\/","title":{"rendered":"Docker Save \u4fdd\u5b58\u5bb9\u5668\u955c\u50cf\u548c Load \u955c\u50cf\u6062\u590d\u64cd\u4f5c"},"content":{"rendered":"<h3>\u5148\u4f7f\u7528\u4e00\u4e2a\u6700\u7b80\u5355 hello-world \u955c\u50cf\u6d4b\u8bd5\u5907\u4efd<\/h3>\n<pre><code>docker pull hello-world\n\n# \u5907\u4efd hello-world \u955c\u50cf\ndocker save hello-world:latest &gt; hello.tar<\/code><\/pre>\n<h3>\u53ef\u4ee5\u4f7f\u7528 <code>vim<\/code> \u53ea\u8bfb\u67e5\u770b hello.tar \u5305<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2021\/09\/1365693008.png\" alt=\"vim.png\" title=\"vim.png\"><\/p>\n<pre><code>vim hello.tar\n<\/code><\/pre>\n<h3><code>Load<\/code> \u955c\u50cf\u6062\u590d\u64cd\u4f5c<\/h3>\n<pre><code># \u5148\u5220\u9664 hello-world \u955c\u50cf\ndocker rmi -f hello-world:latest\n\n# \u6062\u590d \u955c\u50cf\u5907\u4efd\ndocker load  &lt; hello.tar\n\n# \u68c0\u67e5\u955c\u50cf\nsudo docker images\n\ndocker history  hello-world:latest\nIMAGE          CREATED        CREATED BY                                      SIZE      COMMENT\nd1165f221234   6 months ago   \/bin\/sh -c #(nop)  CMD [\"\/hello\"]               0B\n&lt;missing&gt;      6 months ago   \/bin\/sh -c #(nop) COPY file:7bf12aab75c3867a\u2026   13.3kB<\/code><\/pre>\n<h3>\u6211\u4eec\u4e5f\u53ef\u4ee5\u6765\u4e00\u4e2a\u6709\u96be\u5ea6\u7684\u64cd\u4f5c\uff0c\u5728\u5bbf\u4e3b\u673a\u4e0a\u8fd0\u884c <code>hello<\/code><\/h3>\n<pre><code>tar xf hello.tar\ntar xf a803ca04f00ecd1c10fb4978f7a963d1461f4225e568901bc6990cb46a3e04be\/layer.tar\nchmod +x .\/hello\n.\/hello<\/code><\/pre>\n<h3>\u5f53\u7136\u6211\u4eec\u4e5f\u53ef\u4ee5\u76f4\u63a5\u627e\u5230 <code>hello<\/code> \u8fd0\u884c<\/h3>\n<pre><code>apt install locate\nupdatedb\n\nlocate diff\/hello\n\/var\/lib\/docker\/overlay2\/155b07ae99486db146069331596201221591f2f173f231df9f688eae70730572\/diff\/hello<\/code><\/pre>\n<h3>Docker\u4f7f\u7528gzip\u538b\u7f29\u5bfc\u51fa\/\u5bfc\u5165\u955c\u50cf<\/h3>\n<pre><code>\u5bfc\u51fa\u955c\u50cf\ndocker save name:tag | gzip &gt; name_tag.tar.gz\n\n\u5bfc\u5165\u955c\u50cf\ngunzip -c  name_tag.tar.gz | docker load<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u4f7f\u7528\u4e00\u4e2a\u6700\u7b80\u5355 hello-world \u955c\u50cf\u6d4b\u8bd5\u5907\u4efd docker pull hello-worl [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[15],"class_list":["post-415","post","type-post","status-publish","format-standard","hentry","category-docker","tag-docker"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=415"}],"version-history":[{"count":0,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/415\/revisions"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}