{"id":2495,"date":"2018-02-11T16:33:18","date_gmt":"2018-02-11T08:33:18","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2495"},"modified":"2018-02-11T16:33:18","modified_gmt":"2018-02-11T08:33:18","slug":"docker-%e5%ae%9e%e4%be%8b-hello-world","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2495","title":{"rendered":"Docker \u5b9e\u4f8b hello world"},"content":{"rendered":"<p>\n\tDocker \u628a\u5e94\u7528\u7a0b\u5e8f\u53ca\u5176\u4f9d\u8d56\uff0c\u6253\u5305\u5728 image \u6587\u4ef6\u91cc\u9762\u3002\u53ea\u6709\u901a\u8fc7\u8fd9\u4e2a\u6587\u4ef6\uff0c\u624d\u80fd\u751f\u6210 Docker \u5bb9\u5668\u3002\u57fa\u4e8e\u6b64\uff0c\u6211\u4eec\u6765\u5b9e\u73b0\u4e00\u4e2a\u6700\u7b80\u5355\u7684\u5bb9\u5668\uff0c<a href=\"https:\/\/hub.docker.com\/r\/library\/hello-world\/\" target=\"_blank\">hello world<\/a>\u3002\n<\/p>\n<p>\n\t\u9996\u5148\uff0c\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff0c\u5c06 image \u6587\u4ef6\u4ece\u4ed3\u5e93\u6293\u53d6\u5230\u672c\u5730\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\n$ docker image pull library\/hello-world<\/pre>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c<code>docker image pull<\/code>\u662f\u6293\u53d6 image \u6587\u4ef6\u7684\u547d\u4ee4\u3002<code>library\/hello-world<\/code>\u662f image \u6587\u4ef6\u5728\u4ed3\u5e93\u91cc\u9762\u7684\u4f4d\u7f6e\uff0c\u5176\u4e2d<code>library<\/code>\u662f image \u6587\u4ef6\u6240\u5728\u7684\u7ec4\uff0c<code>hello-world<\/code>\u662f image \u6587\u4ef6\u7684\u540d\u5b57\u3002\n<\/p>\n<p>\n\t\u7531\u4e8e Docker \u5b98\u65b9\u63d0\u4f9b\u7684 image \u6587\u4ef6\uff0c\u90fd\u653e\u5728<a href=\"https:\/\/hub.docker.com\/r\/library\/\" target=\"_blank\"><code>library<\/code><\/a>\u7ec4\u91cc\u9762\uff0c\u6240\u4ee5\u5b83\u7684\u662f\u9ed8\u8ba4\u7ec4\uff0c\u53ef\u4ee5\u7701\u7565\u3002\u56e0\u6b64\uff0c\u4e0a\u9762\u7684\u547d\u4ee4\u53ef\u4ee5\u5199\u6210\u4e0b\u9762\u8fd9\u6837\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\n$ docker image pull hello-world<\/pre>\n<p>\n\t\u6293\u53d6\u6210\u529f\u4ee5\u540e\uff0c\u5c31\u53ef\u4ee5\u5728\u672c\u673a\u770b\u5230\u8fd9\u4e2a image \u6587\u4ef6\u4e86\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\n$ docker image ls<\/pre>\n<p>\n\t\u73b0\u5728\uff0c\u8fd0\u884c\u8fd9\u4e2a image \u6587\u4ef6\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\n$ docker container run hello-world<\/pre>\n<p>\n\t<code>docker container run<\/code>\u547d\u4ee4\u4f1a\u4ece image \u6587\u4ef6\uff0c\u751f\u6210\u4e00\u4e2a\u6b63\u5728\u8fd0\u884c\u7684\u5bb9\u5668\u5b9e\u4f8b\u3002\n<\/p>\n<p>\n\t\u6ce8\u610f\uff0c<code>docker container run<\/code>\u547d\u4ee4\u5177\u6709\u81ea\u52a8\u6293\u53d6 image \u6587\u4ef6\u7684\u529f\u80fd\u3002\u5982\u679c\u53d1\u73b0\u672c\u5730\u6ca1\u6709\u6307\u5b9a\u7684 image \u6587\u4ef6\uff0c\u5c31\u4f1a\u4ece\u4ed3\u5e93\u81ea\u52a8\u6293\u53d6\u3002\u56e0\u6b64\uff0c\u524d\u9762\u7684<code>docker image pull<\/code>\u547d\u4ee4\u5e76\u4e0d\u662f\u5fc5\u9700\u7684\u6b65\u9aa4\u3002\n<\/p>\n<p>\n\t\u5982\u679c\u8fd0\u884c\u6210\u529f\uff0c\u4f60\u4f1a\u5728\u5c4f\u5e55\u4e0a\u8bfb\u5230\u4e0b\u9762\u7684\u8f93\u51fa\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\n$ docker container run hello-world\r\n\r\nHello from Docker!\r\nThis message shows that your installation appears to be working correctly.\r\n\r\n... ...<\/pre>\n<p>\n\t\u8f93\u51fa\u8fd9\u6bb5\u63d0\u793a\u4ee5\u540e\uff0c<code>hello world<\/code>\u5c31\u4f1a\u505c\u6b62\u8fd0\u884c\uff0c\u5bb9\u5668\u81ea\u52a8\u7ec8\u6b62\u3002\n<\/p>\n<p>\n\t\u6709\u4e9b\u5bb9\u5668\u4e0d\u4f1a\u81ea\u52a8\u7ec8\u6b62\uff0c\u56e0\u4e3a\u63d0\u4f9b\u7684\u662f\u670d\u52a1\u3002\u6bd4\u5982\uff0c\u5b89\u88c5\u8fd0\u884c Ubuntu \u7684 image\uff0c\u5c31\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4f53\u9a8c Ubuntu \u7cfb\u7edf\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\n$ docker container run -it ubuntu bash<\/pre>\n<p>\n\t\u5bf9\u4e8e\u90a3\u4e9b\u4e0d\u4f1a\u81ea\u52a8\u7ec8\u6b62\u7684\u5bb9\u5668\uff0c\u5fc5\u987b\u4f7f\u7528<a href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/container_kill\/\" target=\"_blank\"><code>docker container kill<\/code><\/a>&nbsp;\u547d\u4ee4\u624b\u52a8\u7ec8\u6b62\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\n$ docker container kill [containID]\r\n<\/pre>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2495\">Docker \u5b9e\u4f8b hello world<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>Docker \u628a\u5e94\u7528\u7a0b\u5e8f\u53ca\u5176\u4f9d\u8d56\uff0c\u6253\u5305\u5728 image \u6587\u4ef6\u91cc\u9762\u3002\u53ea\u6709\u901a\u8fc7\u8fd9\u4e2a\u6587\u4ef6\uff0c\u624d\u80fd\u751f\u6210 Docker \u5bb9\u5668 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[512,706,1134],"class_list":["post-2495","post","type-post","status-publish","format-standard","hentry","category-yyzt","tag-docker","tag-linux","tag-1134"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2495"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2495\/revisions"}],"predecessor-version":[{"id":2496,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2495\/revisions\/2496"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}