{"id":7351,"date":"2018-04-13T09:41:23","date_gmt":"2018-04-13T01:41:23","guid":{"rendered":"http:\/\/rmohan.com\/?p=7351"},"modified":"2018-04-13T09:41:23","modified_gmt":"2018-04-13T01:41:23","slug":"docker-import-and-export-mirrors","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7351","title":{"rendered":"Docker import and export mirrors"},"content":{"rendered":"<p>Docker Import and Export Image<br \/>\nDocker allows you to export the image to a local file. The export command is docker save. First, let&#8217;s look at the use of this command.<br \/>\n[plain] view plain copy<br \/>\n$ sudo docker save &#8211;help<\/p>\n<p>You can see that the docker save command is very simple to use, with a -o parameter to specify which file to output the image to.<br \/>\nEarlier we have downloaded some images, here we put the\u00a0<a title=\"Ubuntu\" href=\"http:\/\/www.linuxidc.com\/topicnews.aspx?tid=2\" target=\"_blank\" rel=\"noopener\">Ubuntu<\/a>\u00a0:14.04 image output file ubuntu1404.tar<br \/>\n[plain] view<br \/>\nplaincopy $ sudo docker save -o ubuntu1404.tar ubuntu:14.04<br \/>\nafter successful export can be in the local file Look under the file<\/p>\n<p>Import Image<br \/>\nDocker Use docker load command to import exported files to local mirror library again<\/p>\n<p>For example, we can import the exported image file ubuntu1404.tar into the local image library again<br \/>\n[plain] view<br \/>\nplaincopy $ sudo docker load -i ubuntu1404.tar<\/p>\n<p>Remove mirror image<br \/>\nremove mirror command docker rmi<\/p>\n<p>The docker rmi can remove one or more images at a time. To remove the image, you can specify that the image ID or image name can remove the specified image. Here we use\u00a0<a title=\"CentOS\" href=\"http:\/\/www.linuxidc.com\/topicnews.aspx?tid=14\" target=\"_blank\" rel=\"noopener\">CentOS which<\/a>\u00a0was just imported\u00a0.<br \/>\n[plain] view plain copy<br \/>\n$ sudo docker rmi centos:centos6<\/p>\n<p>You can see that the image of centos under the local repository has been deleted.<br \/>\nBefore removing an image, ensure that there are no containers under the image (including containers that have been stopped). Otherwise, the image cannot be deleted. You must use docker rm to delete all containers under the image before you can remove the image.<br \/>\nFor example, if we remove the image ubuntu:14.04 it cannot be removed directly because the image has container dependencies.<\/p>\n<p>The contents of the image are temporarily closed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker Import and Export Image Docker allows you to export the image to a local file. The export command is docker save. First, let&#8217;s look at the use of this command. [plain] view plain copy $ sudo docker save &#8211;help<\/p>\n<p>You can see that the docker save command is very simple to use, with a [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7351"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7351"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7351\/revisions"}],"predecessor-version":[{"id":7352,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7351\/revisions\/7352"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}