{"id":13449,"date":"2021-02-08T07:29:07","date_gmt":"2021-02-07T23:29:07","guid":{"rendered":"http:\/\/blog.idc.net\/13449\/"},"modified":"2021-02-08T07:29:07","modified_gmt":"2021-02-07T23:29:07","slug":"ubuntu%e5%ae%89%e8%a3%85%e5%92%8c%e8%bf%90%e8%a1%8cdocker","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/13449\/","title":{"rendered":"Ubuntu\u5b89\u88c5\u548c\u8fd0\u884cDocker"},"content":{"rendered":"<div class=\"idc_table\">\n<h2>\u7b80\u4ecb<\/h2>\n<p>\u4e00\u4e2a\u7c7b\u4f3c\u4e8e\u865a\u62df\u673a\u7684\u8f7b\u91cf\u7ea7\u5bb9\u5668\u3002 <br \/>\u5b98\u65b9\u7f51\u5740https:\/\/www.docker.com <br \/>\u5b98\u65b9\u6709\u4e00\u4e2a\u5728\u7ebf\u6a21\u62df\u73af\u5883\uff1a <br \/>https:\/\/www.docker.com\/tryit\/<\/p>\n<h2>\u5b89\u88c5<\/h2>\n<p>\u4ece\u5b98\u7f51\u4ecb\u7ecd\u6765\u770b\uff0c\u5b83\u652f\u6301\u7684\u64cd\u4f5c\u7cfb\u7edf\u975e\u5e38\u591a\uff0c\u57fa\u672c\u8bb8\u591a\u6211\u6ca1\u89c1\u8fc7\u7684\u3002 <br \/>\u6211\u7684\u6d4b\u8bd5\u73af\u5883\u662fUbuntu Kylin 14.04<\/p>\n<h3>\u9700\u6c42<\/h3>\n<h3>\u5b89\u88c5\u8fc7\u7a0b(\u4f7f\u7528wget)<\/h3>\n<h4>\u5b89\u88c5\u9700\u8981sudo\u6743\u9650<\/h4>\n<h4>\u786e\u5b9a\u5b89\u88c5\u4e86wget<\/h4>\n<blockquote>\n<p>which wget <br \/>\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u4f7f\u7528 <br \/>sudo apt-get update <br \/>sudo apt-get install wget <br \/>\u8fdb\u884c\u5b89\u88c5<\/p>\n<\/blockquote>\n<h4>\u83b7\u53d6\u5305<\/h4>\n<blockquote>\n<p>wget -qO- https:\/\/get.docker.com\/ | sh <br \/>q\u540e\u9762\u662f\u5927\u5199\u5b57\u6bcdO<\/p>\n<\/blockquote>\n<p>\u63d0\u793a\u6210\u529f\u540e\uff0c\u8fd0\u884c\uff1a<\/p>\n<blockquote>\n<\/blockquote>\n<p>\u91cd\u542f\u7cfb\u7edf\uff0c\u8fd0\u884c\uff1a<\/p>\n<blockquote>\n<p>sudo docker run hello-world<\/p>\n<\/blockquote>\n<blockquote>\n<p>sudo docker pull ubuntu <br \/>\u8fd0\u884chello world <br \/>sudo docker run ubuntu \/bin\/echo hello world<\/p>\n<\/blockquote>\n<h3>\u5b89\u88c5\u8fc7\u7a0b(\u4f7f\u7528apt-get)<\/h3>\n<pre><code>$ sudo apt<span>-get<\/span> install apt<span>-transport<\/span><span>-https<\/span>\r\n$ sudo apt<span>-key<\/span> adv <span>--<\/span>keyserver hkp:<span>\/\/keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9<\/span>\r\n$ sudo bash <span>-c<\/span> <span>\"echo deb https:\/\/get.docker.io\/ubuntu docker main &gt; \/etc\/apt\/sources.list.d\/docker.list\"<\/span>\r\n$ sudo apt<span>-get<\/span> update\r\n$ sudo apt<span>-get<\/span> install lxc<span>-docker<\/span><\/code><\/pre>\n<h3>Docker \u5e38\u7528\u547d\u4ee4<\/h3>\n<p>docker images\uff1a\u5217\u51fa\u6240\u6709\u955c\u50cf(images) <br \/>docker ps\uff1a\u5217\u51fa\u6b63\u5728\u8fd0\u884c\u7684(\u5bb9\u5668)containers <br \/>docker pull ubuntu\uff1a\u4e0b\u8f7d\u955c\u50cf <br \/>docker run -i -t ubuntu \/bin\/bash\uff1a\u8fd0\u884cubuntu\u955c\u50cf <br \/>docker commit 3a09b2588478 ubuntu:mynewimage\uff1a\u63d0\u4ea4\u4f60\u7684\u53d8\u66f4\uff0c\u5e76\u4e14\u628a\u5bb9\u5668\u4fdd\u5b58\u6210Tag\u4e3amynewimage\u7684\u65b0\u7684ubuntu\u955c\u50cf.(\u6ce8\u610f\uff0c\u8fd9\u91cc\u63d0\u4ea4\u53ea\u662f\u63d0\u4ea4\u5230\u672c\u5730\u4ed3\u5e93\uff0c\u7c7b\u4f3cGit)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u4ecb \u4e00\u4e2a\u7c7b\u4f3c\u4e8e\u865a\u62df\u673a\u7684\u8f7b\u91cf\u7ea7\u5bb9\u5668\u3002 \u5b98\u65b9\u7f51\u5740https:\/\/www.docker.com \u5b98\u65b9\u6709\u4e00\u4e2a\u5728\u7ebf\u6a21\u62df [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[],"class_list":["post-13449","post","type-post","status-publish","format-standard","hentry","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/13449","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=13449"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/13449\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=13449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=13449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=13449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}