{"id":407,"date":"2019-10-30T09:06:29","date_gmt":"2019-10-30T01:06:29","guid":{"rendered":"http:\/\/blog.maoyunwang.top\/?p=407"},"modified":"2019-10-30T09:06:29","modified_gmt":"2019-10-30T01:06:29","slug":"docker-%e6%b7%b1%e5%85%a5%e6%b5%85%e5%87%ba%ef%bc%9f%ef%bc%9f%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/blog.tongyunli.top\/?p=407","title":{"rendered":"Docker \u6df1\u5165\u6d45\u51fa\uff1f\uff1f\uff1f"},"content":{"rendered":"\n<p>\u672c\u6587\u53ea\u8bb2\u57fa\u7840\u5b9e\u7528\u547d\u4ee4 \u9700\u8981\u4e86\u89e3\u66f4\u6df1\u5165\u7684\u8bf7\u79fb\u6b65\u83dc\u9e1f\u6559\u7a0b\u6216\u8005 \u962e\u4e00\u5cf0\u5927\u4f6c\u7684\u6559\u7a0b<\/p>\n\n\n\n<p>\u672c\u6559\u7a0b\u57fa\u4e8ecentos7  \u4e0d\u5efa\u8bae\u5728windows\u7cfb\u7edf\u4e0b\u5b66\u4e60docker<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Docker \u7684\u5b89\u88c5<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/docs.docker.com\/docker-for-mac\/install\/\" target=\"_blank\" rel=\"noreferrer noopener\">Mac<\/a><\/li><li><a href=\"https:\/\/docs.docker.com\/docker-for-windows\/install\/\" target=\"_blank\" rel=\"noreferrer noopener\">Windows<\/a><\/li><li><a href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/ubuntu\/\" target=\"_blank\" rel=\"noreferrer noopener\">Ubuntu<\/a><\/li><li><a href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/debian\/\" target=\"_blank\" rel=\"noreferrer noopener\">Debian<\/a><\/li><li><a href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/centos\/\" target=\"_blank\" rel=\"noreferrer noopener\">CentOS<\/a><\/li><li><a href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/fedora\/\" target=\"_blank\" rel=\"noreferrer noopener\">Fedora<\/a><\/li><li><a href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/binaries\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u5176\u4ed6 Linux \u53d1\u884c\u7248<\/a><\/li><\/ul>\n\n\n\n<p> \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff0c\u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f\u3002 <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ docker version\n\n# \u6216\u8005\n\n$ docker info\n<\/pre>\n\n\n\n<p>\u67e5\u770b\u672c\u673a\u7684img\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> <code># \u5217\u51fa\u672c\u673a\u7684\u6240\u6709 image \u6587\u4ef6\u3002 <\/code>\n\n<code>$ docker image ls <\/code>\n\n<code># \u5220\u9664 image \u6587\u4ef6 <\/code>\n\n<code>$ docker image rm [imageName]<\/code> <\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"> \u5b9e\u4f8b\uff1ahello world <\/h3>\n\n\n\n<p>\n\n\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff0c\u5c06 image \u6587\u4ef6\u4ece\u4ed3\u5e93\u6293\u53d6\u5230\u672c\u5730\n\n<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> <code>$ docker image pull library\/hello-world<\/code> <\/pre>\n\n\n\n<p> \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  <\/p>\n\n\n\n<p>\u7531\u4e8e Docker \u5b98\u65b9\u63d0\u4f9b\u7684 image \u6587\u4ef6\uff0c\u90fd\u653e\u5728<a rel=\"noreferrer noopener\" 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 <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> <code>$ docker image pull hello-world<\/code> <\/pre>\n\n\n\n<p>\n\n\u6293\u53d6\u6210\u529f\u4ee5\u540e\uff0c\u5c31\u53ef\u4ee5\u5728\u672c\u673a\u770b\u5230\u8fd9\u4e2a image \u6587\u4ef6\u4e86\u3002\n\n<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> <code>$ docker image ls<\/code> <\/pre>\n\n\n\n<p>\n\n\u8fd0\u884c\u8fd9\u4e2a image \u6587\u4ef6\u3002\n\n<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> <code>$ docker container run hello-world<\/code> <\/pre>\n\n\n\n<p><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<\/p>\n\n\n\n<p>\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<\/p>\n\n\n\n<p>\u5982\u679c\u8fd0\u884c\u6210\u529f\uff0c\u4f60\u4f1a\u5728\u5c4f\u5e55\u4e0a\u8bfb\u5230\u4e0b\u9762\u7684\u8f93\u51fa\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> <code>$ docker container run hello-world <\/code>\n\n<code>Hello from Docker! <\/code>\n<code>This message shows that your installation appears to be working correctly. ... ...<\/code> <\/pre>\n\n\n\n<p>\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<\/p>\n\n\n\n<p>\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<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ docker container run -it ubuntu bash<\/code><\/pre>\n\n\n\n<p>\n\n\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\" rel=\"noreferrer noopener\"><code>docker container kill<\/code><\/a>&nbsp;\u547d\u4ee4\u624b\u52a8\u7ec8\u6b62\u3002\n\n<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ docker container kill [containID]<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u53ea\u8bb2\u57fa\u7840\u5b9e\u7528\u547d\u4ee4 \u9700\u8981\u4e86\u89e3\u66f4\u6df1\u5165\u7684\u8bf7\u79fb\u6b65\u83dc\u9e1f\u6559\u7a0b\u6216\u8005 \u962e\u4e00\u5cf0\u5927\u4f6c\u7684\u6559\u7a0b \u672c\u6559\u7a0b\u57fa\u4e8ecentos7 \u4e0d\u5efa\u8bae\u5728 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":299,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[24,22],"class_list":["post-407","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-docker","tag-projk"],"_links":{"self":[{"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=\/wp\/v2\/posts\/407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=407"}],"version-history":[{"count":0,"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=\/wp\/v2\/posts\/407\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=\/"}],"wp:attachment":[{"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.tongyunli.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}