{"id":2491,"date":"2018-02-11T15:31:48","date_gmt":"2018-02-11T07:31:48","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2491"},"modified":"2018-02-11T15:31:48","modified_gmt":"2018-02-11T07:31:48","slug":"docker-%e7%9a%84%e5%ae%89%e8%a3%85","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2491","title":{"rendered":"Docker \u7684\u5b89\u88c5"},"content":{"rendered":"<p>\n\tDocker \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5546\u4e1a\u4ea7\u54c1\uff0c\u6709\u4e24\u4e2a\u7248\u672c\uff1a\u793e\u533a\u7248\uff08Community Edition\uff0c\u7f29\u5199\u4e3a CE\uff09\u548c\u4f01\u4e1a\u7248\uff08Enterprise Edition\uff0c\u7f29\u5199\u4e3a EE\uff09\u3002\u4f01\u4e1a\u7248\u5305\u542b\u4e86\u4e00\u4e9b\u6536\u8d39\u670d\u52a1\uff0c\u4e2a\u4eba\u5f00\u53d1\u8005\u4e00\u822c\u7528\u4e0d\u5230\u3002\u4e0b\u9762\u7684\u4ecb\u7ecd\u90fd\u9488\u5bf9\u793e\u533a\u7248\u3002\n<\/p>\n<p>\n\tDocker CE \u7684\u5b89\u88c5\u8bf7\u53c2\u8003\u5b98\u65b9\u6587\u6863\u3002\n<\/p>\n<ul>\n<li>\n\t\t<a href=\"https:\/\/docs.docker.com\/docker-for-mac\/install\/\" target=\"_blank\">Mac<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/docs.docker.com\/docker-for-windows\/install\/\" target=\"_blank\">Windows<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/ubuntu\/\" target=\"_blank\">Ubuntu<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/debian\/\" target=\"_blank\">Debian<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/centos\/\" target=\"_blank\">CentOS<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/fedora\/\" target=\"_blank\">Fedora<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/binaries\/\" target=\"_blank\">\u5176\u4ed6 Linux \u53d1\u884c\u7248<\/a>\n\t<\/li>\n<\/ul>\n<p>\n\tDocker \u652f\u6301\u4ee5\u4e0b\u7684 Ubuntu \u7248\u672c\uff1a\n<\/p>\n<ul>\n<li>\n\t\tUbuntu Precise 12.04 (LTS)\n\t<\/li>\n<li>\n\t\tUbuntu Trusty 14.04 (LTS)\n\t<\/li>\n<li>\n\t\tUbuntu Wily 15.10\n\t<\/li>\n<li>\n\t\t\u5176\u4ed6\u66f4\u65b0\u7684\u7248\u672c\n\t<\/li>\n<\/ul>\n<p>\n\tDocker \u8981\u6c42 Ubuntu \u7cfb\u7edf\u7684\u5185\u6838\u7248\u672c\u9ad8\u4e8e 3.10 \uff0c\u67e5\u770b\u672c\u9875\u9762\u7684\u524d\u63d0\u6761\u4ef6\u6765\u9a8c\u8bc1\u4f60\u7684 Ubuntu \u7248\u672c\u662f\u5426\u652f\u6301 Docker\u3002\n<\/p>\n<p>\n\t\u901a\u8fc7 uname -r \u547d\u4ee4\u67e5\u770b\u4f60\u5f53\u524d\u7684\u5185\u6838\u7248\u672c\uff1a\n<\/p>\n<pre class=\"brush:bash;\">\r\nxttblog@xttblog:~$ uname -r<\/pre>\n<p>\n\t\u83b7\u53d6\u6700\u65b0\u7248\u672c\u7684 Docker \u5b89\u88c5\u5305:\n<\/p>\n<pre class=\"brush:bash;\">\r\nwget -qO- https:\/\/get.docker.com\/ | sh<\/pre>\n<p>\n\t\u8f93\u5165\u5f53\u524d\u7528\u6237\u7684\u5bc6\u7801\u540e\uff0c\u5c31\u4f1a\u4e0b\u8f7d\u811a\u672c\u5e76\u4e14\u5b89\u88c5Docker\u53ca\u4f9d\u8d56\u5305\u3002\n<\/p>\n<p>\n\t\u5b89\u88c5\u5b8c\u6210\u540e\u6709\u4e2a\u63d0\u793a\uff1a\n<\/p>\n<blockquote>\n<p>\n\t\tIf you would like to use Docker as a non-root user, you should now consider<br \/>\n\t\tadding your user to the &quot;docker&quot; group with something like:\n\t<\/p>\n<p>\n\t\tsudo usermod -aG docker runoob<br \/>\n\t\tRemember that you will have to log out and back in for this to take effect!&nbsp;\n\t<\/p>\n<\/blockquote>\n<p>\n\t\u5f53\u8981\u4ee5\u975eroot\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884cdocker\u65f6\uff0c\u9700\u8981\u6267\u884c sudo usermod -aG docker xttblog \u547d\u4ee4\uff0c\u7136\u540e\u91cd\u65b0\u767b\u5f55\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002\n<\/p>\n<p>\n\t\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff0c\u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\n$ docker version\r\n# \u6216\u8005\r\n$ docker info<\/pre>\n<p>\n\tDocker \u9700\u8981\u7528\u6237\u5177\u6709 sudo \u6743\u9650\uff0c\u4e3a\u4e86\u907f\u514d\u6bcf\u6b21\u547d\u4ee4\u90fd\u8f93\u5165<code>sudo<\/code>\uff0c\u53ef\u4ee5\u628a\u7528\u6237\u52a0\u5165 Docker \u7528\u6237\u7ec4\uff08<a href=\"https:\/\/docs.docker.com\/install\/linux\/linux-postinstall\/#manage-docker-as-a-non-root-user\" target=\"_blank\">\u5b98\u65b9\u6587\u6863<\/a>\uff09\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\n$ sudo usermod -aG docker $USER<\/pre>\n<p>\n\tDocker \u662f\u670d\u52a1\u5668-\u5ba2\u6237\u7aef\u67b6\u6784\u3002\u547d\u4ee4\u884c\u8fd0\u884c<code>docker<\/code>\u547d\u4ee4\u7684\u65f6\u5019\uff0c\u9700\u8981\u672c\u673a\u6709 Docker \u670d\u52a1\u3002\u5982\u679c\u8fd9\u9879\u670d\u52a1\u6ca1\u6709\u542f\u52a8\uff0c\u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u542f\u52a8\uff08<a href=\"https:\/\/docs.docker.com\/config\/daemon\/systemd\/\" target=\"_blank\">\u5b98\u65b9\u6587\u6863<\/a>\uff09\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\n# service \u547d\u4ee4\u7684\u7528\u6cd5\r\n$ sudo service docker start\r\n\r\n# systemctl \u547d\u4ee4\u7684\u7528\u6cd5\r\n$ sudo systemctl start docker<\/pre>\n<p>\n\t\u542f\u52a8docker \u540e\u53f0\u670d\u52a1\n<\/p>\n<pre class=\"brush:bash;\">\r\nsudo service docker start<\/pre>\n<p>\n\t\u6d4b\u8bd5\u8fd0\u884chello-world\n<\/p>\n<pre class=\"brush:bash;\">\r\ndocker run hello-world\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=2491\">Docker \u7684\u5b89\u88c5<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>Docker \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5546\u4e1a\u4ea7\u54c1\uff0c\u6709\u4e24\u4e2a\u7248\u672c\uff1a\u793e\u533a\u7248\uff08Community Edition\uff0c\u7f29\u5199\u4e3a CE\uff09\u548c\u4f01 [&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-2491","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\/2491","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=2491"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2491\/revisions"}],"predecessor-version":[{"id":2492,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2491\/revisions\/2492"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}