\n\u9694\u79bb\u6027<\/td>\n | \u8d44\u6e90\u9650\u5236<\/td>\n | \u5b8c\u5168\u9694\u79bb<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \u200b docker\u6838\u5fc3\u89e3\u51b3\u7684\u95ee\u9898\u662f\u5229\u7528\u5bb9\u5668\u5b9e\u73b0\u7c7b\u4f3cVM\u7684\u529f\u80fd\uff0c\u4ece\u800c\u4ee5\u66f4\u52a0\u8282\u7701\u7684\u786c\u4ef6\u8d44\u6e90\u7ed9\u7528\u6237\u63d0\u4f9b\u66f4\u591a\u7684\u8ba1\u7b97\u8d44\u6e90\uff0c\u5e76\u4e14docker\u64cd\u4f5c\u65b9\u4fbf\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7Dockerfile\u914d\u7f6e\u6587\u4ef6\u652f\u6301\u7075\u6d3b\u7684\u81ea\u52a8\u5316\u521b\u5efa\u548c\u90e8\u7f72\u3002<\/p>\n \u200b\u63a5\u4e0b\u6765\u770b\u4e00\u4e0bDocker\u4e0e\u4f20\u7edf\u865a\u62df\u673a\u67b6\u6784\u7684\u5bf9\u6bd4\uff1a<\/p>\n <\/p>\n \u200b \u901a\u8fc7\u4e0a\u56fe\u53d1\u73b0\uff0c\u865a\u62df\u673a\u662f\u5728\u7269\u7406\u8d44\u6e90\u5c42\u9762\u5b9e\u73b0\u7684\u9694\u79bb\uff0c\u76f8\u5bf9\u4e8e\u865a\u62df\u673a\uff0cDocker\u662f\u57fa\u4e8eAPP\u5c42\u9762\u5b9e\u73b0\u7684\u9694\u79bb\uff0c\u5e76\u4e14\u7701\u53bb\u4e86\u865a\u62df\u673a\u64cd\u4f5c\u7cfb\u7edf\uff0c\u4ece\u800c\u8282\u7701\u4e86\u4e00\u90e8\u5206\u7684\u7cfb\u7edf\u8d44\u6e90\u3002<\/p>\n \u200b Docker\u5b88\u62a4\u8fdb\u7a0b\u53ef\u4ee5\u76f4\u63a5\u4e0e\u4e3b\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u901a\u4fe1\uff0c\u4e3a\u5404\u4e2aDocker\u5bb9\u5668\u5206\u914d\u8d44\u6e90\uff1b\u5b83\u8fd8\u53ef\u4ee5\u5c06\u5bb9\u5668\u4e0e\u4e3b\u64cd\u4f5c\u7cfb\u7edf\u9694\u79bb\uff08\u4e3a\u4e86\u5b89\u5168\uff09\uff0c\u5e76\u5c06\u5404\u4e2a\u5bb9\u5668\u4e92\u76f8\u9694\u79bb\u3002\u865a\u62df\u673a\u542f\u52a8\u9700\u8981\u6570\u5206\u949f\uff0c\u800cDocker\u5bb9\u5668\u53ef\u4ee5\u5728\u6570\u6beb\u79d2\u5185\u542f\u52a8\u3002\u7531\u4e8e\u6ca1\u6709\u81c3\u80bf\u7684\u4ece\u64cd\u4f5c\u7cfb\u7edf\uff0cDocker\u53ef\u4ee5\u8282\u7701\u5927\u91cf\u7684\u78c1\u76d8\u7a7a\u95f4\u4ee5\u53ca\u5176\u4ed6\u7cfb\u7edf\u8d44\u6e90\u3002<\/p>\n \u200b \u7b80\u5355\u6765\u8bf4\uff0c\u865a\u62df\u673a\u548cdocker\u7684\u533a\u522b\u5c31\u5728\u4e8e\u865a\u62df\u673a\u9700\u8981\u901a\u8fc7Hypervisor\u5bf9\u786c\u4ef6\u8d44\u6e90\u4e5f\u8fdb\u884c\u865a\u62df\u5316\uff0c\u800cdocker\u662f\u76f4\u63a5\u4f7f\u7528\u5bbf\u4e3b\u673a\u7684\u786c\u4ef6\u8d44\u6e90\u7684\uff0c\u56e0\u6b64\u865a\u62df\u673a\u7684\u9694\u79bb\u6027\u66f4\u52a0\u5f7b\u5e95\uff0c\u800cdocker\u7684\u9694\u79bb\u6027\u6b21\u4e4b\u3002<\/p>\n Docker\u7684\u6838\u5fc3\u6982\u5ff5<\/strong><\/div>\n1\u3001\u955c\u50cf\u2014\u2014image<\/strong><\/span><\/div>\n\u200b \u53ef\u4ee5\u7406\u89e3\u4e3a\u7c7b\u4f3c\u6211\u4eec\u865a\u62df\u673a\u4e2d\u7684\u5feb\u7167\uff0c\u662f\u521b\u5efa\u5bb9\u5668\u7684\u57fa\u7840\uff0c\u53ef\u4ee5\u8bf4\u65e0\u955c\u50cf\uff0c\u4e0d\u5bb9\u5668\u3002<\/p>\n 2\u3001\u5bb9\u5668\u2014\u2014container<\/strong><\/span><\/div>\n\u200b \u57fa\u4e8e\u955c\u50cf\u521b\u5efa\u7684\u8fd0\u884c\u5b9e\u4f8b\uff0c\u53ef\u4ee5\u88ab\u542f\u52a8\u3001\u505c\u6b62\u548c\u5220\u9664\u3002\u6bcf\u4e2a\u5bb9\u5668\u4e4b\u95f4\u90fd\u662f\u76f8\u4e92\u9694\u79bb\u3001\u4e92\u4e0d\u53ef\u89c1\u7684\u3002<\/p>\n 3\u3001\u4ed3\u5e93\u2014\u2014repository<\/strong><\/span><\/div>\n\u200b \u4fdd\u5b58\u955c\u50cf\u7684\u5730\u65b9\uff0c\u53ef\u4ee5\u7406\u89e3\u4e3a\u955c\u50cf\u56e4\u79ef\u5730\u3002\u53ef\u4ee5\u5c06\u81ea\u5df1\u521b\u5efa\u7684\u8fdb\u884c\u63a8\u9001\u5230\u4ed3\u5e93\u4e2d\uff0c\u65b9\u4fbf\u968f\u65f6\u968f\u5730\u62c9\u53d6\u4f7f\u7528\u3002<\/p>\n \u200b \u4ed3\u5e93\u6ce8\u518c\u670d\u52a1\u5668\uff08registry\uff09\u662f\u5b58\u653e\u4ed3\u5e93\u7684\u5730\u65b9\uff0c\u5176\u4e2d\u5305\u542b\u4e86\u591a\u4e2a\u4ed3\u5e93\uff0c\u6bcf\u4e2a\u4ed3\u5e93\u4e2d\u5b58\u653e\u4e00\u7c7b\u955c\u50cf\uff0c\u5e76\u4e14\u4f7f\u7528\u4e0d\u540c\u7684\u6807\u7b7e\uff08tag\uff09\u6765\u533a\u5206\u3002\u76ee\u524d\u6700\u5927\u7684\u516c\u5171\u4ed3\u5e93\u5c31\u662fDocker Hub\uff0c\u5176\u4e2d\u5b58\u653e\u4e86\u6570\u91cf\u5e9e\u5927\u7684\u955c\u50cf\u7ed9\u7528\u6237\u4e0b\u8f7d\u4f7f\u7528\u3002<\/p>\n \u8fd9\u8fb9\u8865\u5145\u8bf4\u660e\u4e00\u4e0bdocker\u67b6\u6784\uff1a<\/strong><\/span><\/div>\n\u200b Docker\u4f7f\u7528\u5ba2\u6237\u7aef-\u670d\u52a1\u5668\u67b6\u6784\u3002Docker \u5ba2\u6237\u7aef<\/em>\u4e0eDocker \u5b88\u62a4\u8fdb\u7a0b<\/em>\u8fdb\u884c\u5bf9\u8bdd\uff0c\u8be5\u5b88\u62a4\u8fdb\u7a0b<\/em>\u5b8c\u6210\u4e86\u6784\u5efa\uff0c\u8fd0\u884c\u548c\u5206\u53d1Docker\u5bb9\u5668\u7684\u7e41\u91cd\u5de5\u4f5c\u3002Docker\u5ba2\u6237\u7aef\u548c\u5b88\u62a4\u7a0b\u5e8f\u53ef\u4ee5<\/em> \u5728\u540c\u4e00\u7cfb\u7edf\u4e0a\u8fd0\u884c\uff0c\u6216\u8005\u60a8\u53ef\u4ee5\u5c06Docker\u5ba2\u6237\u7aef\u8fde\u63a5\u5230\u8fdc\u7a0bDocker\u5b88\u62a4\u7a0b\u5e8f\u3002Docker\u5ba2\u6237\u7aef\u548c\u5b88\u62a4\u7a0b\u5e8f\u5728UNIX\u5957\u63a5\u5b57\u6216\u7f51\u7edc\u63a5\u53e3\u4e0a\u4f7f\u7528REST API\u8fdb\u884c\u901a\u4fe1\u3002<\/p>\n\u67b6\u6784\u56fe\u793a\uff1a<\/p>\n <\/p>\n Docker\u7684\u5b89\u88c5\u6d41\u7a0b<\/strong><\/div>\n\u57fa\u4e8eLinux\/CentOS7\u7684\u5b89\u88c5\u90e8\u7f72\u6d41\u7a0b\u5982\u4e0b\uff1a<\/p>\n \u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\uff1acentos7.7<\/p>\n 1\u3001\u73af\u5883\u90e8\u7f72<\/strong><\/span><\/div>\n[root@localhost ~]# hostnamectl set-hostname docker\r\n[root@localhost ~]# su\r\n[root@docker ~]# cat \/etc\/RedHat-release \r\nCentOS Linux release 7.7.1908 (Core)\r\n\r\n[root@docker ~]# systemctl stop firewalld && systemctl disable firewalld\r\nRemoved symlink \/etc\/systemd\/system\/multi-user.target.wants\/firewalld.service.\r\nRemoved symlink \/etc\/systemd\/system\/dbus-org.Fedoraproject.FirewallD1.service.\r\n[root@docker ~]# setenforce 0 && sed -i 's\/^SELINUX=.*\/SELINUX=disabled\/' \/etc\/selinux\/config\r\n[root@docker ~]# echo \"net.ipv4.ip_forward=1\" > \/etc\/sysctl.conf #\u5f00\u542f\u8def\u7531\u8f6c\u53d1\r\n[root@docker ~]# sysctl -p #\u52a0\u8f7d\u8def\u7531\u8f6c\u53d1\u529f\u80fd\r\nnet.ipv4.ip_forward = 1\r\n[root@docker ~]# systemctl restart network<\/code><\/pre>\n2\u3001\u5b89\u88c5\u4f9d\u8d56\u5305<\/strong><\/span><\/div>\n[root@docker ~]# yum install -y yum-utils device-mapper-persistent-data lvm2\r\n...\r\n\u66f4\u65b0\u5b8c\u6bd5:\r\n lvm2.x86_64 7:2.02.185-2.el7_7.2 \r\n\r\n\u4f5c\u4e3a\u4f9d\u8d56\u88ab\u5347\u7ea7:\r\n device-mapper.x86_64 7:1.02.158-2.el7_7.2 device-mapper-event.x86_64 7:1.02.158-2.el7_7.2 \r\n device-mapper-event-libs.x86_64 7:1.02.158-2.el7_7.2 device-mapper-libs.x86_64 7:1.02.158-2.el7_7.2 \r\n lvm2-libs.x86_64 7:2.02.185-2.el7_7.2 \r\n\r\n\u5b8c\u6bd5\uff01\r\n<\/code><\/pre>\n\u8bf4\u660e\uff1a<\/p>\n \u5b89\u88c5yum-utils\u8f6f\u4ef6\u5305\u662f\u4e3a\u4e86\u63d0\u4f9b\u4e00\u4e2ayum-config-manager\u5355\u5143\uff0c\u540c\u65f6\u5b89\u88c5\u7684device-mapper-persistent-data\u548clvm2\u7528\u4e8e\u5b58\u50a8\u8bbe\u5907\u6620\u5c04\u5fc5\u987b\u7684\u4e24\u4e2a\u8f6f\u4ef6\u5305\u3002<\/p>\n 3\u3001\u8bbe\u7f6e\u7a33\u5b9a\u7684\u5b58\u50a8\u5e93<\/strong><\/span><\/div>\n[root@docker ~]# yum-config-manager --add-repo https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/centos\/docker-ce.repo\r\n\u5df2\u52a0\u8f7d\u63d2\u4ef6\uff1afastestmirror, langpacks\r\nadding repo from: https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/centos\/docker-ce.repo\r\ngrabbing file https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/centos\/docker-ce.repo to \/etc\/yum.repos.d\/docker-ce.repo\r\nrepo saved to \/etc\/yum.repos.d\/docker-ce.repo\r\n[root@docker ~]# ls \/etc\/yum.repos.d\/ #\u67e5\u770b\u662f\u5426\u52a0\u5165\u4e86\u4e00\u4e2adocker\u6e90\r\nCentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo\r\nCentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo docker-ce.repo\r\n<\/code><\/pre>\n4\u3001\u5b89\u88c5docker\u5f15\u64ce<\/strong><\/span><\/div>\n[root@docker ~]# yum install -y docker-ce \r\n...\r\n\u5df2\u5b89\u88c5:\r\n docker-ce.x86_64 3:19.03.8-3.el7 \r\n\r\n\u4f5c\u4e3a\u4f9d\u8d56\u88ab\u5b89\u88c5:\r\n container-selinux.noarch 2:2.107-3.el7 containerd.io.x86_64 0:1.2.13-3.1.el7 \r\n docker-ce-cli.x86_64 1:19.03.8-3.el7 \r\n\r\n\u5b8c\u6bd5\uff01<\/code><\/pre>\n5\u3001\u521b\u5efadocker\u76ee\u5f55\uff0c\u914d\u7f6e\u955c\u50cf\u52a0\u901f\u670d\u52a1<\/strong><\/span><\/div>\n[root@docker ~]# mkdir \/etc\/docker -p\r\n[root@docker ~]# tee \/etc\/docker\/daemon.json <<-'EOF'\r\n> {\r\n> \"registry-mirrors\": [\"https:\/\/5m9y9qbl.mirror.aliyuncs.com\"]\r\n> }\r\n> EOF\r\n{\r\n \"registry-mirrors\": [\"https:\/\/5m9y9qbl.mirror.aliyuncs.com\"]\r\n}\r\n<\/code><\/pre>\n\u8bf4\u660e\uff1atee\u547d\u4ee4\u2014\u2014\u4ece\u6807\u51c6\u8f93\u5165\u5199\u5f80\u6587\u4ef6\u548c\u6807\u51c6\u8f93\u51fa\uff0c\u5373\u628a\u6807\u51c6\u8f93\u5165\u7684\u6570\u636e\u590d\u5236\u5230\u6bcf\u4e00\u4e2a\u6587\u4ef6FILE, \u540c\u65f6\u9001\u5f80\u6807\u51c6\u8f93\u51fa\u3002<\/p>\n 6\u3001\u5f00\u542f\u670d\u52a1\uff0c\u67e5\u770b\u7248\u672c<\/strong><\/span><\/div>\n[root@docker ~]# systemctl daemon-reload \r\n[root@docker ~]# systemctl restart docker.service \r\n[root@docker ~]# docker -v\r\nDocker version 19.03.8, build afacb8b\r\n\r\n[root@docker ~]# docker version\r\nClient: Docker Engine - Community\r\n Version: 19.03.8\r\n API version: 1.40\r\n Go version: go1.12.17\r\n Git commit: afacb8b\r\n Built: Wed Mar 11 01:27:04 2020\r\n OS\/Arch: linux\/amd64\r\n Experimental: false\r\n\r\nServer: Docker Engine - Community\r\n Engine:\r\n Version: 19.03.8\r\n API version: 1.40 (minimum version 1.12)\r\n Go version: go1.12.17\r\n Git commit: afacb8b\r\n Built: Wed Mar 11 01:25:42 2020\r\n OS\/Arch: linux\/amd64\r\n Experimental: false\r\n containerd:\r\n Version: 1.2.13\r\n GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429\r\n runc:\r\n Version: 1.0.0-rc10\r\n GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd\r\n docker-init:\r\n Version: 0.18.0\r\n GitCommit: fec3683\r\n<\/code><\/pre>\n\u603b\u7ed3<\/strong><\/div>\n\u200b \u672c\u6587\u4e3b\u8981\u4ecb\u7ecd\u4e86docker\u7684\u4f5c\u7528\uff0c\u5c06\u4e4b\u4e0e\u4f20\u7edf\u865a\u62df\u673a\u8fdb\u884c\u7279\u6027\u5bf9\u6bd4\uff0c\u4ee5\u53ca\u67b6\u6784\u5c42\u9762\u7684\u5bf9\u6bd4\uff0c\u63a5\u7740\u8bb2\u8ff0\u6709\u5173docker\u7684\u6838\u5fc3\u4e09\u5927\u7ec4\u6210\uff0c\u6700\u7ec8\u7ed9\u51fa\u57fa\u4e8eLinux\u4e0bCentos7\u64cd\u4f5c\u7cfb\u7edf\u4e2ddocker\u7684\u5b89\u88c5\u6d41\u7a0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u4ece\u56fe\u7247\u4e2d\u5c31\u53ef\u4ee5\u770b\u51fa\u6765\uff0cdocker\u7684\u521b\u5efa\u548c\u5f00\u53d1\u8005\u4eec\u7684\u610f\u56fe\u3002\u9cb8\u9c7c\u2014\u2014\u5bbf\u4e3b\u673a\uff0c\u5757\u72b6\u7bb1\u2014\u2014\u9694\u79bb\u7684\u5bb9\u5668\uff08\u540e\u9762\u4ecb\u7ecd\u4ec0\u4e48\u662f […]<\/p>\n","protected":false},"author":63,"featured_media":178038,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-178033","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/178033","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=178033"}],"version-history":[{"count":1,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/178033\/revisions"}],"predecessor-version":[{"id":178037,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/178033\/revisions\/178037"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/178038"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=178033"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=178033"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=178033"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
|